Skip to content

Commit

Permalink
CI: update documentation to reflect...
Browse files Browse the repository at this point in the history
latest CI changes.

Signed-off-by: Diana Popa <[email protected]>
  • Loading branch information
dianpopa authored and acatangiu committed Oct 29, 2018
1 parent ddcaa19 commit 35d2a32
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 30 deletions.
27 changes: 11 additions & 16 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 <microvm_images_path>
```

In the example above, if `<microvm_images_path>` needs to mirror the structure
of the [s3 test resource bucket](#adding-microvm-images). However, if
In the example above, `<microvm_images_path>` needs to mirror the structure of
the [s3 test resource bucket](#adding-microvm-images). However, if
`<microvm_images_path>` 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`.

Expand Down Expand Up @@ -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
Expand All @@ -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))
```

Expand Down
20 changes: 6 additions & 14 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -76,7 +72,6 @@ def test_with_any_microvm(test_microvm_any, uhttp):
- A fixture that wraps `subprocess.run('<command>, 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.
"""
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 35d2a32

Please sign in to comment.