Skip to content

Conversation

@dreinon
Copy link
Contributor

@dreinon dreinon commented Feb 3, 2022

In the last PR we introduced some changes to the tests. One of them was a cleanup function that double-checked all test buckets were deleted after the tests run, since the empty and delete methods of the bucket fixture don't run if the test that created the bucket fails.
Nevertheless, tests were still failing because of two reasons:

  1. The cleanup function called list_buckets before the buckets were deleted, so sometimes we face a 404 response, which we have to avoid since that means the bucket has already been deleted.
  2. Since we were deleting buckets based on the prefix of their id, when multiple test runs are happening at the same time and one finishes before another one, it would delete all test buckets and tests would fail in the runs that were still going .

The solution to 1) is an easy try and except clause continuing the loop if the status code of the response in the StorageException is a 404.
The solution to 2) is using a list as a global variable to only track the buckets that have been created by the corresponding tests run, in order to delete these in the double_check.

@codecov
Copy link

codecov bot commented Feb 3, 2022

Codecov Report

Merging #140 (2cae0df) into develop (0b61397) will decrease coverage by 0.29%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #140      +/-   ##
===========================================
- Coverage    65.59%   65.29%   -0.30%     
===========================================
  Files            9       10       +1     
  Lines          279      291      +12     
===========================================
+ Hits           183      190       +7     
- Misses          96      101       +5     
Impacted Files Coverage Δ
supabase/__init__.py 100.00% <100.00%> (ø)
supabase/lib/__init__.py 100.00% <100.00%> (ø)
supabase/lib/storage/__init__.py 100.00% <100.00%> (ø)
supabase/lib/storage/storage_bucket_api.py 64.78% <100.00%> (-6.64%) ⬇️
supabase/lib/client_options.py 100.00% <0.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 0b61397...2cae0df. Read the comment docs.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 4, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.34%.

Quality metrics Before After Change
Complexity 2.28 ⭐ 2.60 ⭐ 0.32 👎
Method Length 32.04 ⭐ 31.24 ⭐ -0.80 👍
Working memory 5.86 ⭐ 5.82 ⭐ -0.04 👍
Quality 84.20% 83.86% -0.34% 👎
Other metrics Before After Change
Lines 295 305 10
Changed files Quality Before Quality After Quality Change
supabase/init.py 98.83% ⭐ 98.50% ⭐ -0.33% 👎
supabase/lib/init.py 99.83% ⭐ 96.84% ⭐ -2.99% 👎
supabase/lib/storage/init.py % % %
supabase/lib/storage/storage_bucket_api.py 83.11% ⭐ 83.10% ⭐ -0.01% 👎
tests/test_storage.py 84.66% ⭐ 84.07% ⭐ -0.59% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@dreinon dreinon requested review from J0, anand2312 and leynier February 4, 2022 01:22
Copy link
Contributor

@J0 J0 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 To Me

@dreinon dreinon merged commit 53eeaed into develop Feb 4, 2022
@silentworks silentworks deleted the fix-storage-tests branch July 18, 2024 20:23
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