diff --git a/hack/integration-tests-local.sh b/hack/integration-tests-local.sh index a7860bd4..93e66d62 100755 --- a/hack/integration-tests-local.sh +++ b/hack/integration-tests-local.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -set -x -e -uo pipefail +set -e -uo pipefail + +[ -n "${DEBUG:-}" ] && set -x ## Set up @@ -12,21 +14,21 @@ export AWS_DISABLE_SSL=true DOCKER_NAME='helm-s3-minio' cleanup() { - if $(docker container ls | grep -q "${DOCKER_NAME}\$") ; then - docker container rm --force --volumes "${DOCKER_NAME}" || : + if docker container ls | grep -q "${DOCKER_NAME}$" ; then + docker container rm --force --volumes "${DOCKER_NAME}" &>/dev/null || : fi } cleanup on_exit() { - if [ -z "${SKIP_CLEANUP}" ]; then + if [ -z "${SKIP_CLEANUP:-}" ]; then cleanup fi } trap on_exit EXIT -docker container run -d --rm --name helm-s3-minio \ +docker container run -d --rm --name "${DOCKER_NAME}" \ -p 9000:9000 \ -e MINIO_ACCESS_KEY=$AWS_ACCESS_KEY_ID \ -e MINIO_SECRET_KEY=$AWS_SECRET_ACCESS_KEY \ @@ -39,6 +41,7 @@ if [ ! -x "$(which mc 2>/dev/null)" ]; then popd > /dev/null fi +# give minio time to become service available. sleep 3 mc config host add helm-s3-minio http://localhost:9000 $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY mc mb helm-s3-minio/test-bucket diff --git a/hack/integration-tests.sh b/hack/integration-tests.sh index 92ea7796..3edeaa0c 100755 --- a/hack/integration-tests.sh +++ b/hack/integration-tests.sh @@ -11,7 +11,7 @@ if [ "${IT_HELM_VERSION:0:1}" == "3" ]; then search_arg="repo" fi -set -x +[ -n "${DEBUG:-}" ] && set -x # # Set up diff --git a/tests/e2e/push_test.go b/tests/e2e/push_test.go index 36075735..2c4da7df 100644 --- a/tests/e2e/push_test.go +++ b/tests/e2e/push_test.go @@ -238,7 +238,12 @@ func TestPushRelative(t *testing.T) { t.Errorf("mismatch (-want +got):\n%s", diff) } - os.Chdir(tmpdir) + wd, _ := os.Getwd() + if err := os.Chdir(tmpdir); err != nil { + t.Fatalf("Unexpected error: %v", err) + } + defer os.Chdir(wd) + cmd, stdout, stderr = command(fmt.Sprintf("helm fetch %s/%s --version %s", name, chartName, chartVer)) if err := cmd.Run(); err != nil { t.Errorf("Unexpected error: %v", err)