Skip to content

Commit

Permalink
test: make e2e coverage data in action (#926)
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
  • Loading branch information
qweeah authored Apr 13, 2023
1 parent 9d7edb9 commit 676a8ed
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
- name: Run E2E Tests
run: |
bash $GITHUB_WORKSPACE/test/e2e/scripts/e2e.sh $GITHUB_WORKSPACE --clean
make e2e-covdata
env:
ORAS_PATH: bin/linux/amd64/oras
COVERAGE_DUMP_ROOT: .cover
Expand Down
9 changes: 1 addition & 8 deletions test/e2e/scripts/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,7 @@ if ! [ -z ${COVERAGE_DUMP_ROOT} ]; then
fi

echo " === run tests === "
ginkgo -r -p --succinct suite || fail=true

if ! [ -z ${COVERAGE_DUMP_ROOT} ]; then
echo " === generating code cov report === "
make -C ${repo_root} e2e-covdata || true
fi

if [ "${fail}" = 'true' ]; then
if ! ginkgo -r -p --succinct suite; then
echo " === retriving registry error logs === "
echo '-------- oras distribution trace -------------'
docker logs -t --tail 200 $oras_container_name
Expand Down
16 changes: 15 additions & 1 deletion test/e2e/suite/command/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ var _ = Describe("Common registry users:", func() {
Exec()
})

It("should discover all referrers of a subject via referrers API", func() {
ORAS("discover", subjectRef, "-o", format, "--distribution-spec", "v1.1-referrers-api").
MatchKeyWords(append(discoverKeyWords(false, referrers...), RegistryRef(Host, ArtifactRepo, foobar.Digest))...).
Exec()
})

It("should discover all referrers of a subject with annotations", func() {
ORAS("discover", subjectRef, "-o", format, "-v").
MatchKeyWords(append(discoverKeyWords(true, referrers...), RegistryRef(Host, ArtifactRepo, foobar.Digest))...).
Expand Down Expand Up @@ -170,12 +176,20 @@ var _ = Describe("Fallback registry users:", func() {
MatchKeyWords(append(discoverKeyWords(true, referrers...), RegistryRef(FallbackHost, ArtifactRepo, foobar.Digest))...).
Exec()
})
It("should all referrers of a subject via table output", func() {

It("should discover direct referrers of a subject via table output", func() {
referrers := []ocispec.Descriptor{foobar.FallbackSBOMImageReferrer}
ORAS("discover", subjectRef, "-o", "table").
MatchKeyWords(append(discoverKeyWords(false, referrers...), foobar.Digest)...).
Exec()
})

It("should discover direct referrers explicitly via tag scheme", func() {
referrers := []ocispec.Descriptor{foobar.FallbackSBOMImageReferrer}
ORAS("discover", subjectRef, "-o", "table", "--distribution-spec", "v1.1-referrers-tag").
MatchKeyWords(append(discoverKeyWords(false, referrers...), foobar.Digest)...).
Exec()
})
})
})

Expand Down
8 changes: 7 additions & 1 deletion test/e2e/suite/command/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,17 @@ var _ = Describe("ORAS beginners:", func() {
Exec()
})

It("should fail if no blob reference provided", func() {
It("should fail if no manifest reference provided", func() {
dstRepo := fmt.Sprintf(repoFmt, "delete", "no-reference")
prepare(RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, dstRepo, tempTag))
ORAS("manifest", "delete").ExpectFailure().Exec()
})

It("should fail if no digest provided", func() {
dstRepo := fmt.Sprintf(repoFmt, "delete", "no-reference")
prepare(RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, dstRepo, ""))
ORAS("manifest", "delete", RegistryRef(Host, dstRepo, "")).ExpectFailure().MatchErrKeyWords("name@digest").Exec()
})
})
When("running `manifest fetch-config`", func() {
It("should show preview hint in the doc", func() {
Expand Down

0 comments on commit 676a8ed

Please sign in to comment.