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

SCT-3141 Add support for config repo GitHub release workflow #408

Closed
wants to merge 22 commits into from

Conversation

dauglyon
Copy link
Collaborator

@dauglyon dauglyon commented Sep 27, 2021

Adds support for downloading the validation config from a github release. Addresses step two of the Implementation Plan for Sample Service Validator Workflow. This PR uses the github API to grab the assets. This is because the rate-limit (it seems only for some IPs) can be ~10 downloads per hour (instructions to check your own rate limit). Unfortunately this seems undocumented, but I have hit it a few times. This goes up to the documented 1000 requets per hour per repo when using the API with a token.

@dauglyon dauglyon marked this pull request as draft September 27, 2021 16:27
@dauglyon dauglyon changed the title Add support for config repo GitHub release workflow SCT-3141 Add support for config repo GitHub release workflow Sep 27, 2021
@dauglyon dauglyon marked this pull request as ready for review September 27, 2021 22:38
Copy link
Contributor

@slebras slebras left a comment

Choose a reason for hiding this comment

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

1 comment to clear up

lib/SampleService/core/config.py Outdated Show resolved Hide resolved
Copy link
Contributor

@slebras slebras left a comment

Choose a reason for hiding this comment

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

Looks good

deploy.cfg.tmpl Outdated Show resolved Hide resolved
@eapearson
Copy link
Contributor

The changes to, and the presence of, deploy.cfg, does seem superfluous. That file is generated from deploy.cfg.tmpl in the entrypoint script, so deploy.cfg will be overwritten.
It looks to be a remnant from when python was used to process the config file.

Pipfile Outdated Show resolved Hide resolved
@dauglyon dauglyon changed the base branch from master to develop July 19, 2022 22:31
@dauglyon dauglyon requested a review from scanon July 19, 2022 22:50
@MrCreosote
Copy link
Member

The first thing I notice is that there's no coverage information...

Pipfile Show resolved Hide resolved
deploy.cfg.tmpl Outdated Show resolved Hide resolved
deploy.cfg.tmpl Outdated Show resolved Hide resolved
lib/SampleService/core/config.py Outdated Show resolved Hide resolved
lib/SampleService/core/config.py Show resolved Hide resolved
lib/SampleService/core/config.py Outdated Show resolved Hide resolved
lib/SampleService/core/config.py Outdated Show resolved Hide resolved
lib/SampleService/core/config.py Outdated Show resolved Hide resolved
lib/SampleService/core/config.py Outdated Show resolved Hide resolved
lib/SampleService/core/config.py Outdated Show resolved Hide resolved
@dauglyon dauglyon requested a review from MrCreosote August 12, 2022 20:40
lib/SampleService/core/config.py Outdated Show resolved Hide resolved
lib/SampleService/core/config.py Outdated Show resolved Hide resolved
raise ValueError(f'No release with tag "{tag}" found in validator config repo "{repo_path}"')
else:
# Use the latest release
target_release = releases[0]
Copy link
Member

Choose a reason for hiding this comment

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

I don't seem to see a test for the no provided tag case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

test_config_get_validators_github_bad_tag covers a bad tag. Multiple tests don't provide an explicit tag

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I'm not seeing those. I only see one happy path test and it uses a tag

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

target_release = releases[0]

assets = target_release.get_assets()
if not assets:
Copy link
Member

Choose a reason for hiding this comment

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

There doesn't seem to be a test for this case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

what is "this"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you mean the no-assets case. It's not currently replicable with GH, but the API spec doesnt specifically disallow an empty array here so, this is a "just in case" error that would require mocking GH reponses to test, which i think would be wild overkill

Copy link
Member

@MrCreosote MrCreosote Aug 29, 2022

Choose a reason for hiding this comment

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

If it's practically impossible for this case to occur, I would just take code path out and add a comment that currently google will always have > 0 assets. If things change it'll throw a TypeError which I think is fine

raise ValueError(
f'Failed to open validator configuration file at {url}: {str(e.reason)}') from e
if config_asset:
raise ValueError(f'Error downloading config asset from repo "{repo_path}" '+
Copy link
Member

Choose a reason for hiding this comment

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

There doesn't seem to be a test for this case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Again, its just differentiated error text for an already tested error

Copy link
Member

Choose a reason for hiding this comment

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

Same comment as below re test writing

f'Failed to open validator configuration file at {url}: {str(e)}') from e
if config_asset:
raise ValueError(
f'Failed to open validator configuration file from repo "{repo_path}" '+
Copy link
Member

Choose a reason for hiding this comment

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

There doesn't seem to be a test for this case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mentioned I think in a previous comment, I'm not of the opinion one is needed, as this is the same (already tested) bad-yaml case with different err text. Covered by test_config_get_validators_fail_bad_yaml

Copy link
Member

Choose a reason for hiding this comment

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

I guess I don't understand why you wouldn't add a test? It's an uncovered code path and so should get a test for that code path IMO. The tests look pretty simple to write so naively it seems like a 5 minutes thing. I would certainly write one if it was my PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mostly because it's a weird amount of overhead to use a third party service in tests to test a code path that is only differentiated by earlier (tested) behavior. It's also not a functionally different code path, it just changes what string is thrown...

test/core/arg_checkers_test.py Outdated Show resolved Hide resolved
@dauglyon dauglyon requested review from MrCreosote and removed request for scanon August 23, 2022 00:33
@dauglyon dauglyon closed this Oct 2, 2023
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.

4 participants