-
Notifications
You must be signed in to change notification settings - Fork 92
fix(test): E2E test cases for OCI layout #692
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a7a7b10
fix: E2E test cases for OCI layout
JeyJeyGao b2c1a4a
fix: update code
JeyJeyGao b7d65b0
fix: update test framework
JeyJeyGao 80dadcc
test: added oci-layout test for list command
JeyJeyGao 84aa94d
fix: resolve comment
JeyJeyGao e2347cd
fix: resolve comment
JeyJeyGao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| package notation | ||
|
|
||
| import ( | ||
| "context" | ||
| "os" | ||
| "path/filepath" | ||
|
|
||
| . "github.com/onsi/ginkgo/v2" | ||
| "oras.land/oras-go/v2" | ||
| "oras.land/oras-go/v2/content/oci" | ||
| ) | ||
|
|
||
| // OCILayout is a OCI layout directory for | ||
| type OCILayout struct { | ||
| // Path is the path of the OCI layout directory. | ||
| Path string | ||
| // Tag is the tag of artifact in the OCI layout. | ||
| Tag string | ||
| // Digest is the digest of artifact in the OCI layout. | ||
| Digest string | ||
| } | ||
|
|
||
| // GenerateOCILayout creates a new OCI layout in a temporary directory. | ||
| func GenerateOCILayout(srcRepoName string) (*OCILayout, error) { | ||
| ctx := context.Background() | ||
|
|
||
| if srcRepoName == "" { | ||
| srcRepoName = TestRepoUri | ||
| } | ||
|
|
||
| destPath := filepath.Join(GinkgoT().TempDir(), newRepoName()) | ||
| // create a local store from OCI layout directory. | ||
| srcStore, err := oci.NewFromFS(ctx, os.DirFS(filepath.Join(OCILayoutPath, srcRepoName))) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| // create a dest store for store the generated oci layout. | ||
| destStore, err := oci.New(destPath) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| // copy data | ||
| desc, err := oras.ExtendedCopy(ctx, srcStore, TestTag, destStore, "", oras.DefaultExtendedCopyOptions) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return &OCILayout{ | ||
| Path: destPath, | ||
| Tag: TestTag, | ||
| Digest: desc.Digest.String(), | ||
| }, nil | ||
| } | ||
|
|
||
| // ReferenceWithTag returns the reference with tag. | ||
| func (o *OCILayout) ReferenceWithTag() string { | ||
| return o.Path + ":" + o.Tag | ||
| } | ||
|
|
||
| // ReferenceWithDigest returns the reference with digest. | ||
| func (o *OCILayout) ReferenceWithDigest() string { | ||
| return o.Path + "@" + o.Digest | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...-layout/e2e/blobs/sha256/0d10372ee4448bf319929720bc465c1a6242cc68e82e12c152bc10d541cce578
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...-layout/e2e/blobs/sha256/cc2ae4e91a31a77086edbdbf4711de48e5fa3ebdacad3403e61777a9e1a53b6f
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.