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(profiler): use go 1.18.4 in integration test #6348

Merged
merged 5 commits into from Jul 18, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 24 additions & 9 deletions profiler/kokoro/integration_test.sh 100644 → 100755
Expand Up @@ -34,14 +34,29 @@ export GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_KEYSTORE_DIR}/72935_cloud-profil
export GCLOUD_TESTS_GOLANG_PROJECT_ID="cloud-profiler-e2e"

# Ensure a newer version of Go is used so it is compatible with newer libraries.
# Here we install v1.17.7 which is the current version as of when this code
# was written, following instructions from https://go.dev/doc/manage-install.
# Go modules might not be on for previous versions of Go, so we also have to
# enable the module system explicitly.
export GO111MODULE=on
go install golang.org/dl/go1.17.7
go1.17.7 download
# Here we install v1.18.4 which is the current version as of when this code
# was written.
amchiclet marked this conversation as resolved.
Show resolved Hide resolved
mkdir -p /tmp/bin
GIMME=/tmp/bin/gimme
retry curl -sL -o "$GIMME" https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
chmod +x "$GIMME"

export GIMME_GO_VERSION=1.18.4
Copy link
Member

Choose a reason for hiding this comment

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

Our CI environment already tests on the max supported version and earliest supported version. For instance latest is already using 1.18. Maybe instead of re-downloading the toolchain you just detect that you are running from the latest job. I get there is a kokoro envvar you can read for this information.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback! I think you had similar feedback like last time.

These tests are extra, on top of the general CI tests that are performed in google-cloud-go.

The Go version being used in kokoro is v1.12. We hope to have a more controlled and custom VM for our tests, but unfortunately for now we will still have to use what kokoro provides.

Copy link
Member

Choose a reason for hiding this comment

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

@amchiclet I would consider looking into trampoline. You can bootstrap your env with a container. That is how the common CI works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would love to do things the recommended way. Thanks for the pointer and will look into trampoline when we get a chance.

export GIMME_ENV_PREFIX=/tmp/gimme_envs
install_go() {
"$GIMME"
# If gimme was successful, an .env script that sets up proper environment
# variables will be created.
if [[ -f "${GIMME_ENV_PREFIX}/go${GIMME_GO_VERSION}.env" ]]
Copy link
Contributor

Choose a reason for hiding this comment

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

The script uses "set -eo pipefail", so is this conditional really necessary? If the gimme command fails we wouldn't get here. And even if we do, why not just do source "${GIMME_ENV_PREFIX}/go${GIMME_GO_VERSION}.env" unconditionally and let the command fail if the file is not there, which should fail the script?

Or is this to enable retries? It is not obvious from the comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this can be cleaned up as you suggested. Thanks for pointing this out.

then
source "${GIMME_ENV_PREFIX}/go${GIMME_GO_VERSION}.env"
else
return 1
fi
}
retry install_go

# Run test.
retry go1.17.7 mod download
go1.17.7 test -run TestAgentIntegration -run_only_profiler_backoff_test -timeout 1h
go version
retry go mod download
go test -run TestAgentIntegration -run_only_profiler_backoff_test -timeout 1h