Versions Compared

Key

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

...

The agent simulator and marvin are integrated into maven build phases to help you run basic tests before pushing a commit. These tests are integration tests that will test the CloudStack system as a whole. Management Server will be running during the tests with the Simulator Agent responding to hypervisor commands. For running the checkin tests, your developer environment needs to have Marvin installed and working with the latest CloudStack APIs. These tests are lightweight and should ensure that your commit doesnt break critical functionality for others working with the master branch. The checkin-tests utilize marvin and a one-time installation of marvin will be done so as to fetch all the related dependencies. Further updates to marvin can be done by using the sync mechanism described later in this section. In order for these tests to run on simulator, we need to add an attribute  <required_hardware="false"> to these test cases. 

These build steps are similar to the regular build, deploydb and run of the management server. Only some extra switches are required to run the tests and should be easy to recall and run anytime:

...

Code Block
$ sudo mvn -Pdeveloper,marvin.sync -Dendpoint=localhost -pl :cloud-marvin

Run the Tests

Once the simulator is up, In a separate session you can use the following two commands to bring up an  zone( below example creates an advanced zone with two simulator hypervisors followed by run tests that are tagged to work on the simulator:marvin.setup to bring up a zone with the config specified) and run tests.

 

Code Block
$ mvn -Pdeveloper,marvin.setup -Dmarvin.config=python <cs_code_directory>/tools/marvin/marvin/deployDataCenter.py -i <cs_code_directory>/setup/dev/advanced.cfg -pl :cloud-marvin integration-test

Example configs are available in setup/dev/advanced.cfg and setup/dev/basic.cfg

 

Code Block
$ nosetests-2.7 --with-marvin --marvin

...

Code Block
$ mvn -Pdeveloper,marvin.test -Dmarvin.config=setup/dev/advanced.cfg -pl :cloud-marvin integration-test-config=/home/abc/softwares/cs_4_4_forward/setup/dev/advanced.cfg  -w /home/abc/softwares/cs_4_4_forward/test/integration/smoke/ --with-xunit --xunit-file=/tmp/bvt_selfservice_cases.xml --zone=<zone_mentioned_config> --hypervisor=simulator -a tags=advanced,required_hardware=false

Including your own

Check-In tests are the same as any other tests written using Marvin. The only additional step you need to do is ensure that your test is driven entirely by the API only. This makes it possible to run the test on a simulator. Once you have your test, you need to tag it to run on the simulator so the marvin test runner can pick it up during the checkin-test run. Then place your test module in the test/integration/smoke folder and it will become part of the checkin test run.

...

Tests with more backend verification and complete integration of suites for network, snapshots, templates etc can be found in the test/integration/smoke and test/integration/component. Almost all of these test suites use common library wrappers written around the test framework to simplify writing tests. These libraries are part of the marvin.integrationlib package. Ensure that you have gone through the existing tests related to your feature before writing your own.

...

Code Block
bash
$ nosetests --with-marvin --marvin-config=/path/to/config.cfg -w <test_directory> -a tags=advanced # run tests tagged to run on an advanced zone 

 
#Use below options to run all test cases under smoke directory on advanced zone "and" are provisioning cases, i.e., require hardware to run them. See "hypervisor" option to specify against which hypervisor to run them against, provided your zone and cluster has multiple hosts of various hypervisors type.
$ nosetests-2.7 --with-marvin --marvin-config=/home/abc/softwares/cs_4_4_forward/setup/dev/advanced.cfg  -w /home/abc/softwares/cs_4_4_forward/test/integration/smoke/ --with-xunit --xunit-file=/tmp/bvt_provision_cases.xml --zone=abc<zone_in_zonecfg> --hypervisor=<xenserver\kvm\vmware> -a tags=<advanced>advanced,required_hardware=<true>true


#Use below options to run all test cases under smoke directory on advanced zone "and" are selfservice test cases, i.e., "not" requiring hardware to run them, and can be run against simulator.
$ nosetests-2.7 --with-marvin --marvin-config=/home/abc/softwares/cs_4_4_forward/setup/dev/advanced.cfg  -w /home/abc/softwares/cs_4_4_forward/test/integration/smoke/ --with-xunit --xunit-file=/tmp/bvt_provisionselfservice_cases.xml --zone=abc<zone_in_zonecfg> --hypervisor=<simulator>simulator -a tags=<advanced>advanced,required_hardware=<false>false
 
#Use below options to run all test cases under smoke directory on advanced zone "and" are selfservice test cases, i.e., "not" requiring hardware to run them, and can be run against simulator. As well, below "deploy" option takes care to deploy datacenter as well.
$ nosetests-2.7 --with-marvin --marvin-config=/home/abc/softwares/cs_4_4_forward/setup/dev/advanced.cfg  -w /home/abc/softwares/cs_4_4_forward/test/integration/smoke/ --with-xunit --xunit-file=/tmp/bvt_provision_cases.xml --zone=abc<zone_in_zonecfg> --hypervisor=<simulator>simulator -a tags=<advanced>advanced,required_hardware=<false>false --deploy

Guidelines to choose scenarios for integration

...