This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
support transforming google images #419
Merged
miyunari
merged 4 commits into
redhatcloudx:main
from
miyunari:add_google_transformer_#405
Mar 23, 2023
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fad420c
support transforming google images
miyunari 2cf5e68
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] f150995
remove print and add docstrings to test
miyunari d3e59eb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import os | ||
|
||
|
||
def test_transformer_google(): | ||
"""Run transformer end to end with google input data.""" | ||
assert 0 == os.system( | ||
"poetry run cloudimagedirectory-transformer -f" | ||
" ${PWD}/tests/transformer/testdata/input/google/all.json -op=${PWD} " | ||
" -dp=${PWD}/tests/transformer/testdata -v output" | ||
) | ||
assert 0 == os.system( | ||
"diff ${PWD}/tests/transformer/testdata/expected/google/global/rhel_7_x86_64" | ||
" ${PWD}/tests/transformer/testdata/output/google/global/rhel_7_x86_64" | ||
) |
1 change: 1 addition & 0 deletions
1
tests/transformer/testdata/expected/google/global/rhel_7_x86_64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name": "RHEL 7 X86_64", "arch": "X86_64", "version": "7", "imageId": "rhel-7-v20230306", "date": "2023-03-06T12:57:17.210-08:00", "selflink": "https://console.cloud.google.com/compute/imagesDetail/projects/rhel-cloud/global/images/rhel-7-v20230306"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[ | ||
{ | ||
"architecture": "X86_64", | ||
"archiveSizeBytes": "4944263232", | ||
"creationTimestamp": "2023-03-06T12:57:17.210-08:00", | ||
"description": "Red Hat, Red Hat Enterprise Linux, 7, x86_64 built on 20230306, supports Shielded VM features", | ||
"diskSizeGb": "20", | ||
"family": "rhel-7", | ||
"guestOsFeatures": [ | ||
{ | ||
"type": "UEFI_COMPATIBLE" | ||
}, | ||
{ | ||
"type": "GVNIC" | ||
} | ||
], | ||
"id": "8907890564493208899", | ||
"kind": "compute#image", | ||
"labelFingerprint": "42WmSpB8rSM=", | ||
"licenseCodes": [ | ||
"1000006" | ||
], | ||
"licenses": [ | ||
"https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-7-server" | ||
], | ||
"name": "rhel-7-v20230306", | ||
"rawDisk": { | ||
"containerType": "TAR", | ||
"source": "" | ||
}, | ||
"selfLink": "https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/images/rhel-7-v20230306", | ||
"sourceType": "RAW", | ||
"status": "READY", | ||
"storageLocations": [ | ||
"us", | ||
"asia", | ||
"eu" | ||
] | ||
} | ||
] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could you add a docstring to your tests as well as breaking test cases?
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.
Yes, I can add a docstring. How would you model a breaking test? The only thing that I have in mind is, that the transformer would fail if we provide an invalid input file. Does this make sense to you?
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 that makes total sense to me. I would add
I want to make sure that we can catch those failures should they occur.
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.
Sure, I will create an issue 👍 #421
Is that then a test of the s3cmd tool? 🤔
https://github.com/redhatcloudx/cloud-image-directory/blob/580b08b3e942866f2b1dcd1e28757a690fde5a21/.github/workflows/transformer.yaml#L54-L66
Since the transformer only uses files from the filesystem. We removed the s3 bucket connection (implementation), remember? 🥴
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.
True. Strike the download! We'll cover empty inputs with the rest of the tests in the follow up task!