Top Banner
Testing with Mongo Orchestration
51
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  1. 1. Testing with Mongo Orchestration
  2. 2. Ruby Engineer on the drivers team. Based in Berlin. Work on the gems: bson mongo mongoid bson_ext mongo_kerberos @EmStolfo
  3. 3. MongoDB Drivers C C++ C# Java Node.js Perl PHP Python Ruby Scala
  4. 4. MongoDB Drivers Interface to the server. 10 official drivers available. Many started as OS projects. History
  5. 5. No specifications. Divergent codebases and features. MongoDB Drivers Reality
  6. 6. Server interface was not consistent. MongoDB Drivers Reality
  7. 7. Organizations can experience 1 interface. Specifications guide design and provide documentation. Rewrites with collective knowledge. MongoDB Drivers Revamp
  8. 8. Server interface is a single product. MongoDB Drivers Revamp
  9. 9. Specifications Equally valuable to the drivers team as to the community.
  10. 10. Server Discovery and Monitoring Spec Logic required to make an application using MongoDB highly available.
  11. 11. How to validate compliance?
  12. 12. Test requirements Unit tests. Integration tests. Defined as data. Language-agnostic. Reproducible scenarios. Mongo Orchestration
  13. 13. Testing with Mongo Orchestration 1. Mongo Orchestration 2. Driver integration tests 3. How you can use MO
  14. 14. Mongo Orchestration
  15. 15. Define clusters using JSON. Manipulate clusters via RESTful API. Mongo Orchestration HTTP server providing REST interface to manage multiple MongoDB processes on the same machine. Implemented in python. Maintained by Luke Lovett (llvtt)
  16. 16. What about Automation!? Is intended for testing. Starts processes on one machine. Allows fault injection. Does not have a UI. Has no protection against downtime. Has one agent, so no resiliency. Does not handle operation tasks. Mongo Orchestration.. !
  17. 17. Create different cluster topologies. Single Mongo Orchestration Replica Set Sharded Cluster
  18. 18. Setup
  19. 19. Single server config options
  20. 20. Replica Set config options
  21. 21. Sharded Cluster config options
  22. 22. Define different installations in a config file mongo- orchestration.config
  23. 23. Set up a Replica Set
  24. 24. Benefits of MO Reproducible test scenarios. Abstracts differing configuration options across MongoDB versions. Uniform interface regardless of OS. Ability to define different locations of MongoDB installations for multi- version testing.
  25. 25. Multi-version testing Multi-topology testing SSL Authentication Used internally Drivers integration tests
  26. 26. No need for cluster managers test/tools/mongo_config.rb (cluster manager in 1.x ruby driver)
  27. 27. Jenkins testing
  28. 28. Mongo Connector testing tests/setup_cluster.py
  29. 29. Driver Integration tests
  30. 30. define Format - YAML Tests Scenarios Our approach: DIY testing
  31. 31. benefits Format: YAML Describes data. Can translate to actions. Most languages can use a YAML parsing library. Driver authors write a reusable harness. Changes in the spec can be communicated via additional YAML tests or changes to existing ones.
  32. 32. Integration tests Test driver behavior. Input: cluster state Output: driver behavior Mongo Orchestration
  33. 33. Test harness (in Ruby) PR #584 [WIP] Integration tests using Mongo Orchestration
  34. 34. YAML integration testrs/connection/primary-not-available.yml (I)
  35. 35. YAML integration testrs/connection/primary-not-available.yml (II)
  36. 36. Harness structure 1. Resource (MO cluster) 2. Specification (parsed YAML) 3. Test (can be run) PR #584 [WIP] Integration tests using Mongo Orchestration
  37. 37. Resourcespec/support/mongo_orchestration/resourc e.rb
  38. 38. Specificationspec/support/mongo_orchestration/spe c.rb
  39. 39. Testspec/support/mongo_orchestration/operation/client_operatio n.rb
  40. 40. Restarted primary integration test rs/connection/primary-restarted.yml (I)
  41. 41. Restarted primary integration test rs/connection/primary-restarted.yml (II)
  42. 42. Restarted primary integration testrs/connection/primary-restarted.yml (III)
  43. 43. How you can use Mongo Orchestration
  44. 44. Install
  45. 45. Define different installations in a config file mongo- orchestration.config
  46. 46. start
  47. 47. setup/teardown in python Send requests
  48. 48. stop
  49. 49. General uses of MO Test your applications behavior during a failover. Verify your application can reliably go into readonly mode. Easily test your application with any configuration of MongoDB.
  50. 50. Resources http://bit.ly/testing-mo @EmStolfo