Skip to content

Commit d1015be

Browse files
pb8ozulinx86
authored andcommitted
test: use new CI artifacts and drop dynamic fixtures
microvm capabilities was an interesting idea that is not used in practice. The tests now assume all data is local. To ensure that we fetch all files that could be needed from S3 before running the tests. Also, update to use new artifacts. - Changes to paths since we are moving some custom binaries and scripts. - Changes due to the new rootfs being read-only (squashfs) Changes due to migrating from Ubuntu 18.04 to Ubuntu 22.04, like cpuid output differences. Signed-off-by: Pablo Barbáchano <pablob@amazon.com>
1 parent 9b2a995 commit d1015be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+947
-1962
lines changed

tests/README.md

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -98,71 +98,11 @@ To learn more about Rustacean integration test, see
9898
Tests can be added in any (existing or new) sub-directory of `tests/`, in files
9999
named `test_*.py`.
100100

101-
Fixtures can be used to quickly build Firecracker microvm integration tests
102-
that run on all microvm images in `s3://spec.ccfc.min/img/`.
103-
104-
For example, the test below makes use of the `test_microvm_any` fixture and will
105-
be run on every microvm image in the bucket, each as a separate test case.
106-
107-
``` python
108-
def test_with_any_microvm(test_microvm_any):
109-
response = test_microvm_any.machine_cfg.put(
110-
vcpu_count=2
111-
)
112-
assert(test_microvm_any.api_session.is_good_response(response.status_code))
113-
114-
# [...]
115-
116-
response = test_microvm_any.actions.put(action_type='InstanceStart')
117-
assert(test_microvm_any.api_session.is_good_response(response.status_code))
118-
```
119-
120-
If instead of `test_microvm_any`, a capability-based fixture would be used,
121-
e.g., `test_microvm_with_net`, then the test would instead run on all microvm
122-
images with the `capability:net` tag.
123-
124-
To see what fixtures are available, inspect `conftest.py`.
125-
126101
## Adding Rust Tests
127102

128103
Add a new function annotated with `#[test]` in
129104
[`integration_tests.rs`](../src/vmm/tests/integration_tests.rs).
130105

131-
## Adding Microvm Images
132-
133-
Simply place the microvm image under `s3://spec.ccfc.min/img/`.
134-
The layout is:
135-
136-
``` tree
137-
s3://<bucket-url>/img/
138-
<microvm_test_image_folder_n>/
139-
kernel/
140-
<optional_kernel_name.>vmlinux.bin
141-
fsfiles/
142-
<rootfs_name>rootfs.ext4
143-
<optional_initrd_name.>initrd.img
144-
<other_fsfile_n>
145-
...
146-
<other_resource_n>
147-
...
148-
...
149-
```
150-
151-
Then, tag `<microvm_test_image_folder_n>` with:
152-
153-
``` json
154-
TagSet = [{"key": "capability:<cap_name>", "value": ""}, ...]
155-
```
156-
157-
For example, this can be done from the AWS CLI with:
158-
159-
```sh
160-
aws s3api put-object-tagging \
161-
--bucket ${bucket_name} \
162-
--key img/${microvm_test_image_folder_n} \
163-
--tagging "TagSet=[{Key=capability:${cap_name},Value=''}]"
164-
```
165-
166106
## Adding Fixtures
167107

168108
By default, `pytest` makes all fixtures in `conftest.py` available to all test
@@ -300,17 +240,11 @@ Pytest was chosen because:
300240

301241
### Features
302242

303-
- Modify `MicrovmImageS3Fetcher` to make the above FAQ possible (the borg
304-
pattern is wrong for this).
305243
- A fixture for interacting with microvms via SSH.
306-
- Support generating fixtures with more than one capability. This is supported
307-
by the MicrovmImageS3Fetcher, but not plumbed through.
308244
- Use the Firecracker Open API spec to populate Microvm API resource URLs.
309-
- Manage output better: handle quietness levels, and use pytest reports.
310245
- Do the testrun in a container for better insulation.
311-
- Add support for non-Rust style checks.
312246
- Event-based monitoring of microvm socket file creation to avoid while spins.
313-
- Self-tests (e.g., Tests that test the testing system, python3 style tests).
247+
- Self-tests (e.g., Tests that test the testing system).
314248

315249
### Implementation
316250

@@ -323,8 +257,6 @@ Pytest was chosen because:
323257

324258
### Bug fixes
325259

326-
- Fix the /install-kcov.sh bug.
327-
328260
## Further Reading
329261

330262
Contributing to this testing system requires a dive deep on `pytest`.

0 commit comments

Comments
 (0)