Page MenuHomePhabricator

[blob-service] Clean up uploaded blob data if any test fails
AbandonedPublic

Authored by patryk on Jul 27 2023, 5:38 AM.
Tags
None
Referenced Files
F3061246: D8643.diff
Thu, Oct 24, 12:20 PM
Unknown Object (File)
Tue, Oct 22, 2:30 PM
Unknown Object (File)
Tue, Oct 22, 2:30 PM
Unknown Object (File)
Tue, Oct 22, 2:30 PM
Unknown Object (File)
Tue, Oct 22, 2:30 PM
Unknown Object (File)
Tue, Oct 22, 2:28 PM
Unknown Object (File)
Tue, Oct 22, 5:03 AM
Unknown Object (File)
Mon, Oct 21, 10:44 AM
Subscribers

Details

Summary

Part of ENG-4436.
We should clean up the uploaded test data if any test fails.

Test Plan
  1. Launch the blob service with the command: RUST_LOG=blob=trace cargo run -- --sandbox --localstack-url "http://127.0.0.1:4566" --http-port 50053.
  2. In services/commtest, run yarn run-integration-tests blob. The test should pass.
  3. Comment out lines 36-44 and 92-99.
  4. Run the test twice. An error should occur.
  5. Uncomment lines 92-99 and run the test twice again. This time, the test should pass.

Diff Detail

Repository
rCOMM Comm
Branch
patryk/blob-integration-test
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

patryk held this revision as a draft.
patryk retitled this revision from [blob-service] Move integration tests to separate function to [blob-service] Clean up uploaded blob data if any test fails.Jul 27 2023, 5:55 AM
patryk edited the summary of this revision. (Show Details)
patryk edited the test plan for this revision. (Show Details)
patryk edited reviewers, added: bartek, tomek, michal; removed: jon.
patryk removed a reviewer: michal.
bartek requested changes to this revision.Jul 28 2023, 4:41 AM
  1. This can still break - your cleanup code will fail if something has already been deleted, e.g. when assertion in L38-39 fails. Then, the cleanup error will be displayed instead of the actual error. I placed a suggestion on handling this.

But anyway, the desired effect will be achieved - blobs will be deleted so I'm not requesting to rework the whole approach

  1. Could you replace all occurrences of Err(...)? with return Err(...);?
services/commtest/tests/blob_integration_test.rs
90 ↗(On Diff #29145)

Can we do if let Err(test_failure) = test_results { and then print the test_failure message before continuing with cleanup? See my main comment for reasoning

94–97 ↗(On Diff #29145)

This actually isn't an assertion error but general failure. I'd rather do sth like this

if let Err(err) = remove::run(&client, &item).await {
  eprintln!("failed to clean test data no. {}: {}", i, &err);
  return Err(err);
}

Nit: return Err(err) is IMO more readable than doing Err(err)?

This revision now requires changes to proceed.Jul 28 2023, 4:41 AM

I'm planning to refactor this code. I would like to use the Drop trait to handle removing BlobData, but I need to conduct some research to determine if this solution would be thread-safe.

Unfortunately, I don't have time to fix this diff, so I'll have to abandon it because it requires a refactor.