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

test rex using values from global parameters #17043

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pondrejk
Copy link
Contributor

@pondrejk pondrejk commented Dec 2, 2024

Problem Statement

mostly to cover SAT-28443, but also to check global params usage

Solution

note: It turned out the scenario needs global params and not global settings, but since I already wrote the multi_setting_update fixture, I left it there for potential future use
also stream has hickups with AKs, so holding of prt for now

Related Issues

SAT-28443

@pondrejk pondrejk self-assigned this Dec 2, 2024
@pondrejk pondrejk requested review from a team as code owners December 2, 2024 12:27
@pondrejk pondrejk added Stream Introduced in or relating directly to Satellite Stream/Master No-CherryPick PR doesnt need CherryPick to previous branches Do Not Merge labels Dec 2, 2024
Copy link
Contributor

@lhellebr lhellebr left a comment

Choose a reason for hiding this comment

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

A few questions but generally LGTM

for key_val in key_vals:
param, new_value = tuple(key_val.split('=')) if '=' in key_val else (key_val, None)
existing_params = target_sat.api.CommonParameter().search(query={'search': f'name={param}'})
if len(existing_params) > 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be >1? Should it? Should we assert <=1?



@pytest.fixture
def multi_setting_update(request, target_sat):
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you decided to keep the old fixture, even though this is more generalized, for backwards compatibility?

@@ -311,6 +311,96 @@ def test_positive_run_job_effective_user(
}
)

@pytest.mark.tier3
@pytest.mark.parametrize(
'multi_global_param_update',
Copy link
Contributor

Choose a reason for hiding this comment

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

To self-answer the question I've had: why use global parameters when there are global settings just for this? I think global parameters are used in templating (to setup execution) and global settings are used to actually execute.

'multi_global_param_update',
[
[
'remote_execution_effective_user',
Copy link
Contributor

Choose a reason for hiding this comment

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

param, new_value = tuple(key_val.split('=')) if '=' in key_val else (key_val, None)

So here, you save the parameters and restore them later in cleanup. Only to later set them to some value in the test itself. Isn't it better to just set them to desired value here? Or, if you need randomness, in a separate fixture?

param_object.value = new_value
param_object.update({'value'})
else:
param_object = target_sat.api.CommonParameter(name=param, value=new_value).create()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we check for new_value is not None here?

else:
param_object = target_sat.api.CommonParameter(name=param, value=new_value).create()
cleanup = True
default_param_value = new_value
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? We do cleanup anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do Not Merge No-CherryPick PR doesnt need CherryPick to previous branches Stream Introduced in or relating directly to Satellite Stream/Master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants