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

Cover can_bundle.py in integration tests (#3196) #3237

Merged
merged 4 commits into from
Oct 1, 2021

Conversation

nadove-ucsc
Copy link
Contributor

@nadove-ucsc nadove-ucsc commented Jul 15, 2021

Author

  • PR title references issue
  • Title of main commit references issue
  • PR is linked to Zenhub issue

Author (reindex)

  • Added r tag to commit title or this PR does not require reindexing
  • Added reindex label to PR or this PR does not require reindexing

Author (freebies & chains)

  • Freebies are blocked on this PR or there are no freebies in this PR
  • Freebies are referenced in commit titles or there are no freebies in this PR
  • This PR is blocked by previous PR in the chain or this PR is not chained to another PR
  • Added chain label to the blocking PR or this PR is not chained to another PR

Author (upgrading)

  • Documented upgrading of deployments in UPGRADING.rst or this PR does not require upgrading
  • Added u tag to commit title or this PR does not require upgrading
  • Added upgrade label to PR or this PR does not require upgrading

Author (requirements, before every review)

  • Ran make requirements_update or this PR leaves requirements*.txt, common.mk and Makefile untouched
  • Added R tag to commit title or this PR leaves requirements*.txt untouched
  • Added reqs label to PR or this PR leaves requirements*.txt untouched

Author (before every review)

  • make integration_test passes in personal deployment or this PR does not touch functionality that could break the IT
  • Rebased branch on develop, squashed old fixups

Primary reviewer (after approval)

  • Commented in issue about demo expectations or labelled issue as no demo
  • Decided if PR can be labeled no sandbox
  • PR title is appropriate as title of merge commit
  • Moved ticket to Approved column
  • Assigned PR to an operator

Operator (before pushing merge the commit)

  • Checked reindex label and r commit title tag
  • Checked that demo expectations are clear or issue is labeled as no demo
  • Rebased and squashed branch
  • Sanity-checked history
  • Pushed PR branch to Github
  • Branch pushed to Gitlab or PR is labeled no sandbox
  • Build passes in sandbox and added sandbox label or PR is labeled no sandbox
  • Started reindex in sandbox or this PR does not require reindexing sandbox
  • Checked for failures in sandbox or this PR does not require reindexing sandbox
  • Added PR reference to merge commit title
  • Collected commit title tags in merge commit title
  • Moved linked issue to Merged column
  • Pushed merge commit to Github

Operator (after pushing the merge commit)

  • Moved freebies to Merged column or there are no freebies in this PR
  • Shortened the PR chain or this PR is not the base of another PR
  • Verified that N reviews labelling is accurate
  • Pushed merge commit to Gitlab or this changes can be pushed later, together with another PR
  • Deleted PR branch from Github and Gitlab

Operator (reindex)

  • Started reindex in dev or this PR does not require reindexing or does not target dev
  • Checked for failures in dev or this PR does not require reindexing or does not target dev
  • Started reindex in prod or this PR does not require reindexing or does not target prod
  • Checked for failures in prod or this PR does not require reindexing or does not target prod

Operator

  • Unassigned PR

@github-actions github-actions bot added the orange [process] Done by the Azul team label Jul 15, 2021
@nadove-ucsc nadove-ucsc changed the title Add coverage for can_bundle.py (#3196) Cover can_bundle.py in integration tests (#3196) Jul 15, 2021
@codecov
Copy link

codecov bot commented Jul 15, 2021

Codecov Report

Merging #3237 (22175e3) into develop (eba9a93) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head 22175e3 differs from pull request most recent head b764fed. Consider uploading reports for the commit b764fed to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3237      +/-   ##
===========================================
+ Coverage    82.55%   82.58%   +0.02%     
===========================================
  Files          123      123              
  Lines        14246    14254       +8     
===========================================
+ Hits         11761    11771      +10     
+ Misses        2485     2483       -2     
Impacted Files Coverage Δ
src/azul/__init__.py 81.48% <100.00%> (+0.11%) ⬆️
src/azul/service/elasticsearch_service.py 83.22% <100.00%> (+0.52%) ⬆️
src/azul/service/hca_response_v5.py 92.41% <100.00%> (ø)
src/azul/service/index_query_service.py 90.19% <100.00%> (+0.50%) ⬆️
src/azul/terra.py 63.71% <0.00%> (-0.19%) ⬇️
test/service/test_response.py 99.84% <0.00%> (ø)
src/azul/bigquery_reservation.py 0.00% <0.00%> (ø)
test/indexer/test_hca_indexer.py 99.30% <0.00%> (ø)
src/azul/plugins/metadata/hca/__init__.py 100.00% <0.00%> (ø)
... and 1 more

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 eba9a93...b764fed. Read the comment docs.

@coveralls
Copy link

coveralls commented Jul 15, 2021

Coverage Status

Coverage decreased (-0.3%) to 82.282% when pulling 07397b0 on issues/noah-aviel-dove/3196-it-can-bundle into 051ac80 on develop.

@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch 3 times, most recently from 31d1b85 to ff05567 Compare July 15, 2021 06:58
'--output-dir', output_dir
]
args = [shlex.quote(arg) for arg in args]
result = subprocess.run(args)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just import and call main() directly? It would make debugging easier in the case of a failure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought we weren't supposed to import from scripts/ from other locations

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that you mention it, I remember hearing that too... though I wonder if testing a script like this is worthwhile exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we have to make it an exception because mock.patch can't cross process boundaries, and we need to patch the configured catalogs in order to test the canned repository.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Worth noting that the Pycharm debugger does seem to be capable of crossing process boundaries. When I put a breakpoint in the script and invoked it via subprocess.run, it stopped at the breakpoint).

Copy link
Contributor

Choose a reason for hiding this comment

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

(Worth noting that the Pycharm debugger does seem to be capable of crossing process boundaries. When I put a breakpoint in the script and invoked it via subprocess.run, it stopped at the breakpoint).

Good to know, thanks for testing this.

Copy link
Member

@hannes-ucsc hannes-ucsc Jul 16, 2021

Choose a reason for hiding this comment

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

That can be turned on or off.

image

Note load_script in azul.modules.

plugin = RepositoryPlugin.load(catalog).create(catalog)
spec = first(plugin.sources)
source = plugin.resolve_source(str(spec))
return first(plugin.list_bundles(source, prefix=source.spec.prefix))
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably isn't worth troubling about, but the list_bundles query fetches all the bundles with that prefix when you're only trying to get one. Ideally the size could be specified in the query.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

list_bundles query fetches all the bundles with that prefix

This might be just a confusion of terminology, but RepositoryPlugin.list_bundles does not fetch any bundles, it only lists the bundle FQIDs. RepositoryPlugin.fetch_bundle is a separate method.

Copy link
Member

Choose a reason for hiding this comment

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

It still lists all bundles even though it only needs one. This will definitely cause trouble in dev and prod where no prefix is used on the IT catalogs and 100k+ bundles will be returned. The indexing IT uses a technique to shrink a randomly chosen prefix until 64 bundles match. You should use that or something like that here too. Second, it would be nice to use a randomly selected bundle but the indexing test prefix selection already takes care of that. As always, it should be possible to seed the random generator with minimal code changes in order to be able to reproduce IT failures.

test/integration_test.py Outdated Show resolved Hide resolved
test/integration_test.py Outdated Show resolved Hide resolved
test/integration_test.py Outdated Show resolved Hide resolved
@jessebrennan jessebrennan removed their assignment Jul 19, 2021
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch 2 times, most recently from 7332d6c to 835f65c Compare July 20, 2021 19:37
@nadove-ucsc nadove-ucsc changed the base branch from develop to issues/noah-aviel-dove/3249-move-scripts-args July 20, 2021 19:39
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch 3 times, most recently from 87a3a24 to 6d9f439 Compare July 20, 2021 19:55
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3249-move-scripts-args branch from 6660151 to 591ae73 Compare July 21, 2021 01:28
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch from 6d9f439 to 4c9c7f6 Compare July 21, 2021 01:48
Copy link
Contributor

@jessebrennan jessebrennan left a comment

Choose a reason for hiding this comment

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

I approve, but I think something is wrong with the history. The first commit shouldn't show up in this PR, but rather in the PR for 3249. Probably you just need to rebase onto that branch again.

@jessebrennan jessebrennan removed their assignment Jul 21, 2021
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch 2 times, most recently from 6a4091a to 57405b0 Compare July 21, 2021 20:01
@hannes-ucsc
Copy link
Member

Should I be assigned?

@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch from caee57c to ae262b5 Compare September 15, 2021 10:54
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch 2 times, most recently from ddea6a5 to 717e8b6 Compare September 23, 2021 02:09
@nadove-ucsc nadove-ucsc changed the base branch from develop to issues/noah-aviel-dove/3452-it-nondeterminism September 23, 2021 02:10
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch from 717e8b6 to f9704f2 Compare September 23, 2021 02:29
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3452-it-nondeterminism branch from 3d8cee4 to 9eebd30 Compare September 23, 2021 22:50
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch from f9704f2 to b5390c0 Compare September 23, 2021 23:18
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3452-it-nondeterminism branch 2 times, most recently from 3977d35 to cfaaacb Compare September 28, 2021 01:36
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch from b5390c0 to c92e549 Compare September 28, 2021 03:29
@nadove-ucsc nadove-ucsc changed the base branch from issues/noah-aviel-dove/3452-it-nondeterminism to develop September 28, 2021 03:29
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch from c92e549 to 68ac757 Compare September 28, 2021 08:35
@nadove-ucsc nadove-ucsc removed the sandbox [process] Resolution is being verified in sandbox deployment label Sep 28, 2021
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch from 68ac757 to b764fed Compare September 29, 2021 02:49
@hannes-ucsc hannes-ucsc removed the hold warm [process] PR can't land just yet but needs to be rebased daily label Sep 29, 2021
@nadove-ucsc nadove-ucsc force-pushed the issues/noah-aviel-dove/3196-it-can-bundle branch from b764fed to 07397b0 Compare October 1, 2021 04:23
@nadove-ucsc nadove-ucsc merged commit 2fbf613 into develop Oct 1, 2021
@nadove-ucsc nadove-ucsc added the sandbox [process] Resolution is being verified in sandbox deployment label Oct 1, 2021
@nadove-ucsc nadove-ucsc deleted the issues/noah-aviel-dove/3196-it-can-bundle branch October 1, 2021 05:51
@nadove-ucsc nadove-ucsc removed their assignment Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4+ reviews [process] Lead requested changes four times or more orange [process] Done by the Azul team sandbox [process] Resolution is being verified in sandbox deployment upgrade [process] PR includes commit requiring manual upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants