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: Implement logic to clear LocalGcs after each test #1661

Merged
merged 2 commits into from
Mar 5, 2021

Conversation

pawelpasterz
Copy link
Contributor

@pawelpasterz pawelpasterz commented Mar 5, 2021

Fixes #1578

Change description:

  • there are only 2 tests that require pre-uploaded files -- now they upload filed on their own (ArgsHelperTest#assertGcsFileExists succeeds & TestRunnerTest#mockedAndroidTestRun gcsAndHistoryName)
  • Google API provides FakeStorageRpc which is created with LocalStorageHelper.getOptions()
  • FakeStorageRpc can be cleaned/reseted only by calling LocalStorageHelper.getOptions() (both its hashmaps are cleared)
  • Above is, unfortunately, the only way to clear FakeStorageRpc -- storage has reset method but it's not exposed
  • The TestStorageProvider is introduced to wrap additional test logic
  • Intention behind TestStorageProvider is GcStorage should not be aware of how it is used (tests or production )
  • The TestStorageProvider has nullable Storage filed. It can be cleared (set null) with #clearStorage
  • If storage is null TestStorageProvider will invoke LocalStorageHelper.getOptions() and assign reference to storage field.
  • FlankTestRunner has a custom listener that will invoke LocalGcs#clear() after each test run

Test Plan

How do we know the code works?

Unfortunately, there is no straightforward way to verify it since OOM error occurred only on GH Actions machines, randomly.

@pawelpasterz pawelpasterz self-assigned this Mar 5, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2021

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2021

Timestamp: 2021-03-05 12:59:52
Buildscan url for ubuntu-workflow run 624465647
https://gradle.com/s/pdd6aycqraa2g

@bootstraponline bootstraponline force-pushed the 1578-clear-localgsc-during-tests branch from e22a415 to abaaa42 Compare March 5, 2021 12:17
@pawelpasterz
Copy link
Contributor Author

@flank-it

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2021

Integration tests succeed for all OSes ✅
Windows Build scan:
MacOS Build scan:
Linux Build scan: https://gradle.com/s/xj3xcfn4375la
Workflow run https://github.com/Flank/flank/actions/runs/624381115

@mergify mergify bot merged commit 1b66685 into master Mar 5, 2021
@mergify mergify bot deleted the 1578-clear-localgsc-during-tests branch March 5, 2021 13:29
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LocalGcs should be cleaned after each test
3 participants