From 35d2a32af777eee9edad7e10497aa22a7b0578bb Mon Sep 17 00:00:00 2001 From: Diana Popa Date: Fri, 12 Oct 2018 07:01:47 -0500 Subject: [PATCH] CI: update documentation to reflect... latest CI changes. Signed-off-by: Diana Popa --- tests/README.md | 27 +++++++++++---------------- tests/conftest.py | 20 ++++++-------------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/tests/README.md b/tests/README.md index b3d7ae1e5bb..a6258e93b6f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -11,7 +11,7 @@ To run all tests: ./testrun.sh ``` -This will download test microvm images from the default test resource s3 bucket, +This will download test microvm images from the default test resource S3 bucket, and run all available tests. To run tests from specific directories and/or files: @@ -21,16 +21,16 @@ To run tests from specific directories and/or files: ``` To run all tests using a local directory for microvm images (as opposed to -downloading them from the s3 bucket): +downloading them from the S3 bucket): ``` sh ./testrun.sh --local-images-path ``` -In the example above, if `` needs to mirror the structure -of the [s3 test resource bucket](#adding-microvm-images). However, if +In the example above, `` needs to mirror the structure of +the [s3 test resource bucket](#adding-microvm-images). However, if `` does not exist, it will be created, and the resources -from the s3 testing bucket will be downloaded there. This means that to run +from the S3 testing bucket will be downloaded there. This means that to run with a local directory for microvm images, you can simply run twice with the same path passed to `--local-images-path`. @@ -60,7 +60,7 @@ For help on usage, see `./testrun.sh (-h|--help)` - Several basic GNU/Linux utilities: `curl`, `getopt`, `date`. - Root mode. -Each testrun will create a temporary sandbox and install all other required +Each test session will create a temporary sandbox and install all other required dependencies. ### Caveats @@ -78,24 +78,19 @@ named `test_*.py`. Fixtures can be used to quickly build Firecracker microvm integration tests that run on all microvm images in `s3://spec.firecracker/microvm-images/`. -For example, the test below makes use of the `test_microvm_any` test microvm -fixture, this test will be run on on every microvm image in the bucket, each as -a separate test case. +For example, the test below makes use of the `test_microvm_any` fixture and will +be run on every microvm image in the bucket, each as a separate test case. ``` python def test_with_any_microvm(test_microvm_any): - response = test_microvm_any.api_session.put( - test_microvm_any.microvm_cfg_url, - json={'vcpu_count': 2} + response = test_microvm_any.machine_cfg.put( + vcpu_count=2 ) assert(test_microvm_any.api_session.is_good_response(response.status_code)) # [...] - response = test_microvm_any.api_session.put( - test_microvm_any.actions_url, - json={'action_type': 'InstanceStart'} - ) + response = test_microvm_any.actions.put(action_type='InstanceStart') assert(test_microvm_any.api_session.is_good_response(response.status_code)) ``` diff --git a/tests/conftest.py b/tests/conftest.py index 3d8d4facfdb..fb73c53107b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -47,21 +47,17 @@ # Example ``` -def test_with_any_microvm(test_microvm_any, uhttp): +def test_with_any_microvm(test_microvm_any): - response = uhttp.put( - test_microvm_any.microvm_cfg_url, - json={'vcpu_count': 2} + response = test_microvm_any.machine_cfg.put( + vcpu_count=8 ) - assert(uhttp.is_good_response(response.status_code)) + assert(test_microvm_any.api_session.is_good_response(response.status_code)) # [...] - response = uhttp.put( - test_microvm_any.actions_url, - json={'action_type': 'InstanceStart'} - ) - assert(uhttp.is_good_response(response.status_code)) + response = test_microvm_any.actions.put(action_type='InstanceStart') + assert(test_microvm_any.api_session.is_good_response(response.status_code)) ``` The test above makes use of the "any" test microvm fixture, so this test will @@ -76,7 +72,6 @@ def test_with_any_microvm(test_microvm_any, uhttp): - A fixture that wraps `subprocess.run(', shell=True, check=True)`, and also controls output verbosity by appending `>/dev/null [&2>1]`. - A fixture that allows per-test-function dependency installation. -- Monitor of socket file creation via inotify. - Support generating fixtures with more than one capability. This is supported by the MicrovmImageFetcher, but not by the fixture template. """ @@ -258,9 +253,6 @@ def test_microvm_any(request, microvm, microvm_image_fetcher): # capabilities present in the test microvm images bucket. `pytest` doesn't # provide a way to do that outright, but luckily all of python is just lists of # of lists and a cursor, so exec() works fine here. -# -# TODO: Support generating fixtures with more than one capability. This is -# supported by the MicrovmImageFetcher, but not by the fixture template. for capability in microvm_image_fetcher().enum_capabilities(): test_microvm_cap_fixture = ( TEST_MICROVM_CAP_FIXTURE_TEMPLATE.replace('CAP', capability)