Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration tests using the spread framework #15

Merged
merged 3 commits into from
May 16, 2023
Merged

Conversation

IsaacJT
Copy link
Collaborator

@IsaacJT IsaacJT commented Apr 12, 2023

This changeset adds the required files for running tests inside generated VM images using the spread framework (https://github.com/snapcore/spread).

Spread tests can be run by running the following commands (the build directory refers to the location where the Kiwi images were built):

mkdir -p ~/.spread/qemu
cp build/nemos-image-minimal-lunar.x86_64-1.0.1.qcow2 \
    ~/.spread/qemu/nemos-image-minimal-lunar.img
cp build/nemos-image-reference-lunar.x86_64-1.0.1.qcow2 \
    ~/.spread/qemu/nemos-image-reference-lunar.img
spread -v

These tests can be used to automatically verify that features are present and enabled in the generated images.

@IsaacJT IsaacJT added the WIP Work In Progress label Apr 12, 2023
@IsaacJT IsaacJT requested a review from schaefi April 12, 2023 13:40
@IsaacJT IsaacJT self-assigned this Apr 12, 2023
@IsaacJT IsaacJT requested review from schaefi and removed request for schaefi April 12, 2023 13:40
@IsaacJT
Copy link
Collaborator Author

IsaacJT commented Apr 12, 2023

This PR depends on the following PRs being merged in spread upstream:

And depends on this PR in nemos-images: #16

@IsaacJT
Copy link
Collaborator Author

IsaacJT commented Apr 12, 2023

Example test result:

$ spread -v
2023-04-12 15:41:51 Found /home/itrue/git/Elektrobit/nemos-images/spread.yaml.
2023-04-12 15:41:51 Project content is packed for delivery (724.64KB).
2023-04-12 15:41:51 Sequence of jobs produced with -seed=1681306911
2023-04-12 15:41:51 If killed, discard servers with: spread -reuse-pid=1470193 -discard
2023-04-12 15:41:51 Allocating qemu:nemos-image-minimal-lunar...
2023-04-12 15:41:51 Serial and monitor for qemu:nemos-image-minimal-lunar available at ports 59464 and 59564.
2023-04-12 15:41:51 Allocating qemu:nemos-image-reference-lunar...
2023-04-12 15:41:51 Serial and monitor for qemu:nemos-image-reference-lunar available at ports 59436 and 59536.
2023-04-12 15:41:51 Waiting for qemu:nemos-image-minimal-lunar to make SSH available...
2023-04-12 15:41:51 Waiting for qemu:nemos-image-reference-lunar to make SSH available...
2023-04-12 15:41:52 Allocated qemu:nemos-image-reference-lunar.
2023-04-12 15:41:52 Allocated qemu:nemos-image-minimal-lunar.
2023-04-12 15:41:52 Connecting to qemu:nemos-image-reference-lunar...
2023-04-12 15:41:52 Connecting to qemu:nemos-image-minimal-lunar...
2023-04-12 15:42:11 Connected to qemu:nemos-image-minimal-lunar at localhost:59364.
2023-04-12 15:42:11 Sending project content to qemu:nemos-image-minimal-lunar...
2023-04-12 15:42:11 Executing qemu:nemos-image-minimal-lunar:tests/spread/os-information-23.04 (qemu:nemos-image-minimal-lunar) (1/3)...
2023-04-12 15:42:11 Discarding qemu:nemos-image-minimal-lunar...
2023-04-12 15:42:13 Connected to qemu:nemos-image-reference-lunar at localhost:59336.
2023-04-12 15:42:13 Sending project content to qemu:nemos-image-reference-lunar...
2023-04-12 15:42:13 Executing qemu:nemos-image-reference-lunar:tests/spread/storage-configuration (qemu:nemos-image-reference-lunar) (2/3)...
2023-04-12 15:42:13 Executing qemu:nemos-image-reference-lunar:tests/spread/os-information-23.04 (qemu:nemos-image-reference-lunar) (3/3)...
2023-04-12 15:42:13 Discarding qemu:nemos-image-reference-lunar...
2023-04-12 15:42:13 Successful tasks: 3
2023-04-12 15:42:13 Aborted tasks: 0

@schaefi
Copy link
Contributor

schaefi commented Apr 12, 2023

Really cool stuff and I like it. At EB the testing team seems to use the robot framework through qemu, thus a similar approach but with different tools. It might be valuable to communicate the way you (Canonical) drives the tests to the EB QA team in the next meeting. What do you think ?

I really like the combination of spread and github workflows, this is cool stuff

@IsaacJT
Copy link
Collaborator Author

IsaacJT commented Apr 12, 2023

Yes sounds good, would be great to do a deep dive on this topic together. I'll add it as a topic to next week's technical call.

Spread was mostly developed for snapd - if you're curious you can see it in action with a massive matrix of tests that are carried out for each PR: https://github.com/snapcore/snapd/actions/workflows/test.yaml

@IsaacJT IsaacJT force-pushed the add-spread-tests branch 2 times, most recently from 3f9ec37 to 988e7da Compare May 4, 2023 07:56
IsaacJT added 2 commits May 4, 2023 11:00
…emove bash

Bash is needed for the spread automated testing suite, and we do not
have a hard requirement to remove it in the everything-enabled reference
image, so we can leave it installed.

Signed-off-by: Isaac True <isaac.true@canonical.com>
Quote the YAML values and specify DEBIAN_FRONTEND=noninteractive to
ensure that apt does not freeze waiting on user input that will never
come.

Signed-off-by: Isaac True <isaac.true@canonical.com>
@IsaacJT IsaacJT force-pushed the add-spread-tests branch 2 times, most recently from 2bf61bf to 290213d Compare May 10, 2023 12:47
@IsaacJT IsaacJT force-pushed the add-spread-tests branch 2 times, most recently from 498c460 to 9d262ec Compare May 16, 2023 09:03
This adds the required files for running tests inside generated VM
images using the spread framework (https://github.com/snapcore/spread).

Spread tests can be run by running the following commands (the build
directory refers to the location where the Kiwi images were built):

```
mkdir -p ~/.spread/adhoc
cp build/nemos-image-minimal-lunar.x86_64-1.0.1.qcow2 \
    ~/.spread/adhoc/nemos-image-minimal-lunar.qcow2
cp build/nemos-image-reference-lunar.x86_64-1.0.1.qcow2 \
    ~/.spread/adhoc/nemos-image-reference-lunar.qcow2
spread -v adhoc:
```

Signed-off-by: Isaac True <isaac.true@canonical.com>
@IsaacJT IsaacJT force-pushed the add-spread-tests branch from 9d262ec to 50f7e5a Compare May 16, 2023 09:43
@IsaacJT IsaacJT removed the WIP Work In Progress label May 16, 2023
@IsaacJT
Copy link
Collaborator Author

IsaacJT commented May 16, 2023

@schaefi this is ready for review now

Copy link
Contributor

@schaefi schaefi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic 👍 I really like it. Thanks for the effort

@schaefi schaefi merged commit b61d6cc into master May 16, 2023
@schaefi schaefi deleted the add-spread-tests branch May 16, 2023 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants