-
Notifications
You must be signed in to change notification settings - Fork 637
test: update workflow #1851
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: update workflow #1851
Changes from all commits
e762e46
73c17ef
ecf8dd0
b9cf467
74b121b
98dedd3
55377b2
a4db138
38b4eef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,60 +3,32 @@ | |
| set -eu -o pipefail | ||
|
|
||
| : "${BUILDX_CMD=docker buildx}" | ||
| : "${CACHE_FROM=}" | ||
| : "${CACHE_TO=}" | ||
|
|
||
| : ${TEST_INTEGRATION=} | ||
| : ${TEST_REPORT_SUFFIX=} | ||
| : ${TEST_KEEP_CACHE=} | ||
| : ${TEST_DOCKERD=} | ||
| : ${TEST_BUILDKIT_IMAGE=} | ||
|
|
||
| if [ -n "$CACHE_FROM" ]; then | ||
| for cfrom in $CACHE_FROM; do | ||
| setFlags+=(--set "*.cache-from=$cfrom") | ||
| done | ||
| fi | ||
| if [ -n "$CACHE_TO" ]; then | ||
| for cto in $CACHE_TO; do | ||
| setFlags+=(--set "*.cache-to=$cto") | ||
| done | ||
| fi | ||
|
|
||
| if [ "$#" == 0 ]; then TEST_INTEGRATION=1; fi | ||
| : "${TEST_IMAGE_BUILD=1}" | ||
| : "${TEST_IMAGE_ID=buildx-tests}" | ||
|
|
||
| while test $# -gt 0; do | ||
| case "$1" in | ||
| integration) | ||
| TEST_INTEGRATION=1 | ||
| ;; | ||
| *) | ||
| echo "unknown arg $1" | ||
| ;; | ||
| esac | ||
| shift | ||
| done | ||
| : "${TEST_REPORT_SUFFIX=}" | ||
| : "${TEST_KEEP_CACHE=}" | ||
| : "${TEST_DOCKERD=}" | ||
| : "${TEST_BUILDKIT_IMAGE=}" | ||
|
|
||
| iid="buildx-tests" | ||
| if [ "$TEST_IMAGE_BUILD" = "1" ]; then | ||
| ${BUILDX_CMD} bake integration-test --set "*.output=type=docker,name=$TEST_IMAGE_ID" | ||
| fi | ||
|
|
||
| testReportsDir="$(pwd)/bin/testreports" | ||
| mkdir -p "$testReportsDir" | ||
| testReportsVol="-v $testReportsDir:/testreports" | ||
| gotestsumArgs="--format=standard-verbose --jsonfile=/testreports/go-test-report$TEST_REPORT_SUFFIX.json --junitfile=/testreports/junit-report$TEST_REPORT_SUFFIX.xml" | ||
| gotestArgs="-mod=vendor -coverprofile=/testreports/coverage-report$TEST_REPORT_SUFFIX.txt -covermode=atomic" | ||
|
|
||
| ${BUILDX_CMD} bake integration-test "${setFlags[@]}" --set "*.output=type=docker,name=$iid" | ||
|
|
||
| cacheVolume="buildx-test-cache" | ||
| if ! docker container inspect "$cacheVolume" >/dev/null 2>/dev/null; then | ||
| docker create -v /root/.cache -v /root/.cache/registry -v /go/pkg/mod --name "$cacheVolume" alpine | ||
| fi | ||
|
|
||
| if [ "$TEST_INTEGRATION" == 1 ]; then | ||
| cid=$(docker create --rm -v /tmp $testReportsVol --volumes-from=$cacheVolume -e GITHUB_REF -e TEST_DOCKERD -e TEST_BUILDKIT_IMAGE -e SKIP_INTEGRATION_TESTS -e GOTESTSUM_FORMAT ${BUILDKIT_INTEGRATION_SNAPSHOTTER:+"-eBUILDKIT_INTEGRATION_SNAPSHOTTER"} -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry --privileged $iid gotestsum $gotestsumArgs --packages="${TESTPKGS:-./...}" -- $gotestArgs ${TESTFLAGS:--v}) | ||
| docker start -a -i $cid | ||
| fi | ||
|
|
||
| if [ "$TEST_KEEP_CACHE" != "1" ]; then | ||
| docker rm -v $cacheVolume | ||
| trap 'docker rm -v $cacheVolume' EXIT | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI - this was pulled from buildkit's
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes indeed I was looking at making some changes in BuildKit related to this 👍 |
||
| fi | ||
|
|
||
| cid=$(docker create --rm -v /tmp $testReportsVol --volumes-from=$cacheVolume -e GITHUB_REF -e TEST_DOCKERD -e TEST_BUILDKIT_IMAGE -e SKIP_INTEGRATION_TESTS -e GOTESTSUM_FORMAT ${BUILDKIT_INTEGRATION_SNAPSHOTTER:+"-eBUILDKIT_INTEGRATION_SNAPSHOTTER"} -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry --privileged $TEST_IMAGE_ID gotestsum $gotestsumArgs --packages="${TESTPKGS:-./...}" -- $gotestArgs ${TESTFLAGS:--v}) | ||
| docker start -a -i $cid | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd like to keep this if possible, we still default to integration if nothing else is specified.
I think we're going to need to create another suite of integration tests at some point to test the complexities of driver creation, e.g. there are a lot of options for setting up the kubernetes driver. These tests don't test the commands package directly, so it would make more sense to split it out, so we can run them in parallel etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On BuildKit we needed this special case because we got to test the frontend specifically and also the gateway and I don't think we need to have this kind of logic in buildx.
Right we just invoke buildx binary for the inspect command integration test atm so we don't cover the
commandspackage but don't think we need other kind of invocation of the integrations tests container like we do in BuildKit.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think our special case will come from wanting to test the commands specifically, and then also test the driver creation specifically. We'll probably want different types of environment for both (e.g. the driver creation tests will probably need to configure buildkit servers with different combinations of tls options, or spin up unique k8s clusters per test).
We might not do that though, so I think it's ok to simplify this for now, and we can always add it back in later.