-
Notifications
You must be signed in to change notification settings - Fork 56
Add dist git branch to testing farm context #2936
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
Open
m-blaha
wants to merge
1
commit into
packit:main
Choose a base branch
from
m-blaha:branch-testingfarm-env
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -47,6 +47,9 @@ | |
| ) | ||
| from packit_service.worker.handlers import TestingFarmHandler | ||
| from packit_service.worker.handlers import TestingFarmResultsHandler as TFResultsHandler | ||
| from packit_service.worker.helpers.testing_farm import ( | ||
| DownstreamTestingFarmJobHelper, | ||
| ) | ||
| from packit_service.worker.helpers.testing_farm import ( | ||
| TestingFarmClient as TFClient, | ||
| ) | ||
|
Comment on lines
+50
to
55
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
@@ -2348,3 +2351,50 @@ def test_parse_comment_arguments( | |
| assert helper.comment_arguments.identifier == expected_identifier | ||
| assert helper.comment_arguments.labels == expected_labels | ||
| assert helper.comment_arguments.envs == expected_envs | ||
|
|
||
|
|
||
| def test_downstream_tf_base_payload(): | ||
| """Test that _get_tf_base_payload returns the correct payload structure.""" | ||
| service_config = ServiceConfig.get_service_config() | ||
| service_config.testing_farm_api_url = "https://api.testing-farm.io/v0.1/" | ||
| service_config.testing_farm_secret = "secret-token" | ||
|
|
||
| # Create a mock koji_build with a specific target | ||
| koji_build = flexmock( | ||
| task_id="12345678", | ||
| target="rawhide", | ||
| ) | ||
|
|
||
| # Create the helper with minimal required mocks | ||
| helper = DownstreamTestingFarmJobHelper( | ||
| service_config=service_config, | ||
| project=flexmock(repo="test-package"), | ||
| metadata=flexmock( | ||
| commit_sha="abcd1234", | ||
| ), | ||
| koji_build=koji_build, | ||
| ) | ||
|
|
||
| # Call the method under test | ||
| payload = helper._get_tf_base_payload(distro="fedora-rawhide", compose="Fedora-Rawhide") | ||
|
|
||
| # Verify the complete payload structure | ||
| assert payload["environments"] == [ | ||
| { | ||
| "arch": "x86_64", | ||
| "os": {"compose": "Fedora-Rawhide"}, | ||
| "tmt": { | ||
| "context": { | ||
| "distro": "fedora-rawhide", | ||
| "arch": "x86_64", | ||
| "trigger": "commit", | ||
| "initiator": "fedora-ci", | ||
| "dist-git-branch": "rawhide", | ||
| } | ||
| }, | ||
| "artifacts": [ | ||
| {"id": "12345678", "type": "fedora-koji-build"}, | ||
| ], | ||
| "variables": {"KOJI_TASK_ID": "12345678"}, | ||
| } | ||
| ] | ||
Oops, something went wrong.
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.
targetisn't always equal to branch name. There can be aelnbuild from therawhidebranch (and other cases, but those shouldn't really be initiated by Packit, so we can ignore them).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.
Oh, thanks. Will try to find a better approach.
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.
I've just noticed there is an alternative solution - #2935 . Is this appproach correct?
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.
I would say so.