Skip to content

Commit

Permalink
Merge pull request #2158 from mtrmac/storage-test-simplify
Browse files Browse the repository at this point in the history
Simplify storage test setup
  • Loading branch information
mtrmac authored Oct 31, 2023
2 parents 646dbde + 672a3e0 commit 53c4f5d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/BurntSushi/toml v1.3.2
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01
github.com/containers/ocicrypt v1.1.8
github.com/containers/storage v1.50.2
github.com/containers/storage v1.50.3-0.20231025175120-a254f71b1f55
github.com/cyberphone/json-canonicalization v0.0.0-20230710064741-aa7fe85c7dbd
github.com/docker/distribution v2.8.3+incompatible
github.com/docker/docker v24.0.7+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 h1:Qzk5C6cYgle
github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY=
github.com/containers/ocicrypt v1.1.8 h1:saSBF0/8DyPUjzcxMVzL2OBUWCkvRvqIm75pu0ADSZk=
github.com/containers/ocicrypt v1.1.8/go.mod h1:jM362hyBtbwLMWzXQZTlkjKGAQf/BN/LFMtH0FIRt34=
github.com/containers/storage v1.50.2 h1:Fys4BjFUVNRBEXlO70hFI48VW4EXsgnGisTpk9tTMsE=
github.com/containers/storage v1.50.2/go.mod h1:dpspZsUrcKD8SpTofvKWhwPDHD0MkO4Q7VE+oYdWkiA=
github.com/containers/storage v1.50.3-0.20231025175120-a254f71b1f55 h1:Iq92jXLWTGs+if3emvvKIPmbD2V9f6pKzTZZB/DNlJQ=
github.com/containers/storage v1.50.3-0.20231025175120-a254f71b1f55/go.mod h1:F94jcfBI/h/0ixpWAu8KsLQiXFdTwUZ6kNO26MN8PlE=
github.com/coreos/go-oidc/v3 v3.7.0 h1:FTdj0uexT4diYIPlF4yoFVI5MRO1r5+SEcIpEw9vC0o=
github.com/coreos/go-oidc/v3 v3.7.0/go.mod h1:yQzSCqBnK3e6Fs5l+f5i0F8Kwf0zpH9bPEsbY00KanM=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down
25 changes: 10 additions & 15 deletions storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,16 @@ func newStoreWithGraphDriverOptions(t *testing.T, options []string) storage.Stor
wd := t.TempDir()
run := filepath.Join(wd, "run")
root := filepath.Join(wd, "root")
// Due to https://github.com/containers/storage/pull/811 , c/storage can be used on macOS unprivileged,
// and this actually causes problems because the PR linked above does not exclude UID changes on some code paths.
// This condition should be removed again if https://github.com/containers/storage/pull/1735 is merged.
if runtime.GOOS != "darwin" {
Transport.SetDefaultUIDMap([]idtools.IDMap{{
ContainerID: 0,
HostID: os.Getuid(),
Size: 1,
}})
Transport.SetDefaultGIDMap([]idtools.IDMap{{
ContainerID: 0,
HostID: os.Getgid(),
Size: 1,
}})
}
Transport.SetDefaultUIDMap([]idtools.IDMap{{
ContainerID: 0,
HostID: os.Getuid(),
Size: 1,
}})
Transport.SetDefaultGIDMap([]idtools.IDMap{{
ContainerID: 0,
HostID: os.Getgid(),
Size: 1,
}})
store, err := storage.GetStore(storage.StoreOptions{
RunRoot: run,
GraphRoot: root,
Expand Down

0 comments on commit 53c4f5d

Please sign in to comment.