-
Notifications
You must be signed in to change notification settings - Fork 50
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
design and implement generic unit tests for all rocks #817
Comments
Thank you for reporting us your feedback! The internal ticket has been created: https://warthogs.atlassian.net/browse/KF-5303.
|
A really easy mistake in a rockcraft.yaml file is to do: override-build:
command1
command2 when you mean: override-build: |
command1
command2 Should we warn for this sort of thing? Same with any |
Another useful test would be a negative file match, for example to assert |
This is similar to #783 |
Another issue with current ("standardised) unit tests we have in ROCKs e.g. here is that we have a fixture which is not used and thus container is not cleaned up after running sanity environment. This fixture was originially designed to be used in that manner but this was dismissed somewhere along the line. EDIT: A good implementation of this can be seen here. |
Context
When updating rocks, it would be useful to have simple unit or sanity tests for our rocks. These are tests that can be executed quickly (either linting the rockcraft.yaml itself, or examining a rock that has already been built). For example, being able to test:
["/home/username/my_data", "/bin/my_executable", ...]
)Out of scope here would be integration tests or anything that actually executes the rock.
We have a few examples of this, like seldon which implements the tests here, but not all rocks use these. Some later charms attempted to simplify the tests a bit, but it could still be done further. We should have these tests consistently applied across our repos.
Our current tests do share some common code, but the tests themselves are defined as code rather than configuration (each rock needs its own
test_rock.py
file) which adds a lot of boilerplate. We could simplify these to use common test tools and just add configuration via config (for example, replace test_rock.py withassert_file_in_rock.py --file "/home/username/my_data" --file "/bin/my_executable"
,assert_rock_version_scheme.py
, ...)What needs to get done
Definition of Done
The text was updated successfully, but these errors were encountered: