-
Notifications
You must be signed in to change notification settings - Fork 1
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
ENH: Bump images and add upload all script #18
Conversation
271cec6
to
412d392
Compare
The old submodule was still hanging around, clean-up this and bump the one used to the latest copy
- Drop 1.24 as this is n-2 EOL versions behind - Bump 1.25 to latest EOL version to allow people to upgrade - Bump all images including new n-1 versions from latest release
Since we now have a number of images to manage, add a Python script to automatically upload these with the appropriate names...etc. using the OpenStack SDK Longer-term it would be nice to drive the builds with Python but small incremental steps first
Now we have two scripts, lets call this scripts otherwise it's a bit confusing
Adds standard CI suite for our new Python scripts, including formatting and pylint
Adds black to the list of available pre-commit runners and reformat the existing files
Resolve and suppress newly found pylint warnings on CI job
The previous v1.25 image wasn't supported so adding it back introduced an older version to people we're trying to upgrade up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small changes. Mostly just change prints to logging
scripts/test/test_upload_all.py
Outdated
assert mocked_upload_single_image.call_count == 0 | ||
|
||
|
||
def _expected_args_helper(file: Path, visibility: str) -> Dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be a fixture?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I keep forgetting we have pytest 🤦♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I remember why
In test_upload_images_to_openstack_real_run
I want to simulate two images being created, the problem is the struct holds the filename for each.
This means I need to generate two fixture objects with different paths or simply use list comprehension and a factory pattern like we did here:
expected = [
call(args.os_cloud, _expected_args_helper(file, "public"))
for file in expected_files
]
Do you know of an easy way to use fixtures with a pattern a little bit like:
def test_upload_images_to_openstack_real_run(fixture_1, fixture_2, [Path(file_1), Path(file_2)]):
Since most of the solutions I can see multiple the boilerplate?
Switches to logging instead of print statements Use assert_* methods instead of manually emulating similar effects by using call_count and arg_list parameters with assert
Fixtures explicitly map onto lifetime and makes it clear how the object is used within a test. By switching to it, we've brought this in-line with other unit testing patterns across projects
Description
See each commit for further details.
Testing
cluster-api
to prep for an image buildscripts/build-all.sh
to build your imagesscripts/upload-all.sh
to upload all the images as per the instructions to a scratch space