Skip to content

Fix missing_assets to ignore repos, not 'hidden assets' #3017

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

Merged
merged 1 commit into from
May 6, 2020

Conversation

AdamWill
Copy link
Contributor

As discussed in
#2676 (comment)
and follow-ups, this check misunderstands the "hidden" attribute.
The code assumes that "hidden" assets are the same thing as
"assets we don't really want to copy down when cloning jobs",
but they are not. The "hidden" attribute was written (by me) to
mean "asset types not to be shown for downloading in the web UI".

For SUSE, it happens to be the case that ["repo"] would be the
right array of both "not-to-be-shown-in-the-web-ui assets" and
"non-clonable assets", so this bug wasn't apparent, as SUSE
deployments leave the hide_asset_types config setting at its
default value of just 'repo'. But on Fedora deployments, this
setting is changed to 'repo iso hdd' (because we don't want to
show those asset types for download in the web UI), so this code
also ignored ISO and HDD assets when checking for "missing"
assets, which we don't want.

As discussed in the pull request we could potentially make this
a configurable attribute and have the clone_job script use it
too, but doing that is a bit harder, and I don't think for now
anyone wants a different definition of "non-clonable assets", so
it doesn't seem really necessary.

Signed-off-by: Adam Williamson awilliam@redhat.com

@AdamWill
Copy link
Contributor Author

Failure looks like a test flake (my other current PR, which touches something completely different, has a similar failure).

my @relevant_assets
= grep { $_->{name} ne '' && !OpenQA::Schema::Result::Assets::is_type_hidden($_->{type}) } values %$assets;
= grep { $_->{name} ne '' && $_->{type} ne 'repo' } values %$assets;
Copy link
Member

Choose a reason for hiding this comment

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

@Martchus do you know if we need this for other assets, e.g. the uefi vars images?

Copy link
Contributor

Choose a reason for hiding this comment

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

On our production instances we don't configure hide_asset_types so it is just repo anyways. So this change makes no difference for us.

Copy link
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

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

The change itself looks good. The name of the subtest 'hidden assets are ignored' in 15-assets.t should be adjusted. The description for the check should be adjusted as well and diag explain can be removed.

my @relevant_assets
= grep { $_->{name} ne '' && !OpenQA::Schema::Result::Assets::is_type_hidden($_->{type}) } values %$assets;
= grep { $_->{name} ne '' && $_->{type} ne 'repo' } values %$assets;
Copy link
Contributor

Choose a reason for hiding this comment

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

On our production instances we don't configure hide_asset_types so it is just repo anyways. So this change makes no difference for us.

@AdamWill
Copy link
Contributor Author

AdamWill commented May 5, 2020

Good points about the tests, I'll fix that up today.

As discussed in
os-autoinst#2676 (comment)
and follow-ups, this check misunderstands the "hidden" attribute.
The code assumes that "hidden" assets are the same thing as
"assets we don't really want to copy down when cloning jobs",
but they are not. The "hidden" attribute was written (by me) to
mean "asset types not to be shown for downloading in the web UI".

For SUSE, it happens to be the case that ["repo"] would be the
right array of both "not-to-be-shown-in-the-web-ui assets" and
"non-clonable assets", so this bug wasn't apparent, as SUSE
deployments leave the `hide_asset_types` config setting at its
default value of just 'repo'. But on Fedora deployments, this
setting is changed to 'repo iso hdd' (because we don't want to
show those asset types for download in the web UI), so this code
also ignored ISO and HDD assets when checking for "missing"
assets, which we don't want.

As discussed in the pull request we could potentially make this
a configurable attribute and have the clone_job script use it
too, but doing that is a bit harder, and I don't think for now
anyone wants a different definition of "non-clonable assets", so
it doesn't seem really necessary.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
@AdamWill AdamWill force-pushed the fix-missing-asset-hidden branch from 4a09ded to 43c290f Compare May 5, 2020 19:16
@AdamWill
Copy link
Contributor Author

AdamWill commented May 5, 2020

OK, test revised as per @Martchus 's suggestions.

@codecov
Copy link

codecov bot commented May 5, 2020

Codecov Report

Merging #3017 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3017   +/-   ##
=======================================
  Coverage   92.03%   92.03%           
=======================================
  Files         211      211           
  Lines       12846    12846           
=======================================
  Hits        11823    11823           
  Misses       1023     1023           
Impacted Files Coverage Δ
lib/OpenQA/Schema/Result/Jobs.pm 97.20% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d3dd0c...43c290f. Read the comment docs.

Copy link
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM

@Martchus Martchus merged commit e7c7ac9 into os-autoinst:master May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants