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

test(e2e): add E2E testing utilities and sample specs #639

Merged
merged 126 commits into from
Nov 9, 2022

Conversation

qweeah
Copy link
Contributor

@qweeah qweeah commented Oct 11, 2022

This PR includes below changes in the E2E utility package:

  1. Enables basic auth in test infra
  2. Supports excuting oras or other binaries with fluent-styled runtime configuring and result matching
  3. Introduces match packages to validate execution results
  4. Added sample test specs for manifest fetch command and common OCI image scenario.

Resolves #554, resolves #555, resolves #556, resolves #565

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
rm -rf $mnt_root/docker
for layer in $(ls $mnt_root/*.tar.gz); do
tar -xvzf $layer -C $mnt_root
done
trap 'docker kill oras-e2e || true' ERR
docker run -d -p 5000:5000 --rm --name oras-e2e \
--env STORAGE_DELETE_ENABLED=true \
docker run --pull always -d -p 5000:5000 --rm --name oras-e2e \
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to --pull always?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default behavior is missing, which can be wrong if github provided an uncleaned VM. always is more defensive.

--mount type=bind,source=$mnt_root/docker,target=/opt/data/registry-root-dir/docker \
--mount type=bind,source=$mnt_root/passwd_bcrypt,target=/etc/docker/registry/passwd \
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we generate passwd file on the fly? I have concerns that security checkers will scan the repo and find we are storing credentials.

Copy link
Contributor Author

@qweeah qweeah Nov 8, 2022

Choose a reason for hiding this comment

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

It's doable but will complicate the setup. Can we set this aside and consider the design in another issue #680 with configurable username/password/token?

test/e2e/README.md Outdated Show resolved Hide resolved
test/e2e/internal/utils/exec.go Show resolved Hide resolved
test/e2e/internal/utils/exec.go Outdated Show resolved Hide resolved
test/e2e/internal/utils/match/keywords.go Outdated Show resolved Hide resolved
test/e2e/internal/utils/match/matchable.go Outdated Show resolved Hide resolved
test/e2e/internal/utils/match/status.go Outdated Show resolved Hide resolved
test/e2e/internal/utils/match/status.go Outdated Show resolved Hide resolved
test/e2e/internal/utils/match/status.go Outdated Show resolved Hide resolved
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
test/e2e/internal/utils/exec.go Outdated Show resolved Hide resolved
test/e2e/internal/utils/match/status.go Outdated Show resolved Hide resolved
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

@shizhMSFT shizhMSFT merged commit 2d65e5c into oras-project:main Nov 9, 2022
TerryHowe pushed a commit to TerryHowe/oras that referenced this pull request Feb 2, 2023
This PR includes below changes in the E2E utility package:
1. Enables basic auth in test infra
2. Supports excuting oras or other binaries with fluent-styled runtime
configuring and result matching
3. Introduces `match` packages to validate execution results
4. Added sample test specs for `manifest fetch` command and common OCI
image scenario.

Resolves oras-project#554, resolves oras-project#555, resolves oras-project#556, resolves oras-project#565

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants