Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The simulator changes makes it easy to write tests for various scenarios that was not possible earlier, especially negative/fault scenarios. Now it is possible to write end-to-end tests for VM deployment retry logic, HA, migration etc. This document takes some of these scenarios to explain the simulator changes.

User VM HA (source code test/integration/smoke/misc/test_vm_ha.py)

Scenario

  1. Deploy HA enabled user VM
  2. Simulate host failure in CS using the new mock framework
  3. CS triggers HA on the user VM in created in step 1

...

The count parameter is used to make sure that the mock is active only for 'count' times. Every time a mock successfully executes count is decremented by 1. This parameter can be used to make sure that the mock actually got executed as expected and that the test failure is due to the mock and not due to some other issues. For e.g. take a look at test/integration/smoke/misc/test_deploy_vm.py where there are tests for VM deployment retry logic.

The jsonResponse parameter is used to pass a json string that is expected as response as part of agent command execution. This data is simply deserialized into a json object and returned from the agent layer. Take a look at test/integration/smoke/misc/test_vm_sync.py.

Cleanup

As part of cleanup, clear all the mocks created during setup so that subsequent tests are not impacted by them. The mocks are cleaned up by simply setting the 'removed' field.