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

fix(ci): fix shadow-copy test #3629

Merged
merged 18 commits into from
Feb 7, 2024
Merged

Conversation

aaron-kasten
Copy link
Collaborator

@aaron-kasten aaron-kasten commented Feb 7, 2024

Fixes #3628

Copy link

codecov bot commented Feb 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cb455c6) 75.86% compared to head (f5427a3) 77.12%.
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3629      +/-   ##
==========================================
+ Coverage   75.86%   77.12%   +1.25%     
==========================================
  Files         470      470              
  Lines       37301    28430    -8871     
==========================================
- Hits        28299    21927    -6372     
+ Misses       7071     4574    -2497     
+ Partials     1931     1929       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aaron-kasten aaron-kasten changed the title fix(cli): Fixup 3624 A (a PR to trigger builds) fix(cli): Attempt to fixup shadow-copy test Feb 7, 2024
BUILD.md Outdated
@@ -125,6 +125,7 @@ $ make -C site build

This will auto-generate [Markdown](https://en.wikipedia.org/wiki/Markdown) files with documentation for currently supported Kopia CLI subcommands and store them under `site/content/docs/Reference/Command-Line` and then generate the website which is stored in `site/public`.


Copy link
Collaborator

Choose a reason for hiding this comment

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

nit; drop this

maybe your editor does this automatically ? Some of my vim plugins used to do this until I configured them to not do auto formatting on existing files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Shrekster I added to trigger a test. I'll remove it.

@@ -46,6 +48,10 @@ func TestShadowCopy(t *testing.T) {
}

sources := clitestutil.ListSnapshotsAndExpectSuccess(t, e)

require.NotEmpty(t, sources)
require.NotEmpty(t, sources[0].Snapshots)
Copy link
Collaborator

Choose a reason for hiding this comment

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

good check

The existing code is a bit confusing though... would we get at-least one snapshot if we do not have the permission ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nothing to do here but I find a couple more issues with this test, for example getting any other error besides os.ErrPermission would be suppressed at first and fail later ... not a deal breaker, but I'd prefer to fail fast.

Copy link
Contributor

Choose a reason for hiding this comment

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

I probably should've added a comment to clarify what this is doing. An error is guaranteed here since the all-zero GUID is not a valid shadow copy ID. This is purely an "are you an admin?" check designed to match what go-vss is doing to know which version of the test to execute.

Also, yes, a Kopia snapshot is created in both scenarios. The test would've simply panicked previously if that didn't happen.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I probably should've added a comment to clarify what this is doing. An error is guaranteed here since the all-zero GUID is not a valid shadow copy ID. This is purely an "are you an admin?" check designed to match what go-vss is doing to know which version of the test to execute.

It makes sense to add the comment for clarity, it makes it easier to understand the test.

a Kopia snapshot is created in both scenarios. The test would've simply panicked previously if that didn't happen.

Nevertheless, it makes sense to check explicitly than letting the test panic. It makes it easier to track down test failures.

@julio-lopez julio-lopez changed the title fix(cli): Attempt to fixup shadow-copy test fix(ci): fix shadow-copy test Feb 7, 2024
@julio-lopez julio-lopez enabled auto-merge (squash) February 7, 2024 04:47
Copy link
Collaborator

@julio-lopez julio-lopez left a comment

Choose a reason for hiding this comment

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

@aaron-kasten
🥇Thanks for doing this!!!

@julio-lopez julio-lopez merged commit 769d5f3 into kopia:master Feb 7, 2024
25 checks passed
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.

Failure in tests/os_snapshot_test TestShadowCopy
4 participants