-
Notifications
You must be signed in to change notification settings - Fork 508
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
Run E2E tests during CI #363
Changes from all commits
32fe18b
6ba5b94
e9a137b
fba78e9
3db118b
a1b6480
8c926e8
54ea3ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
# test_e2e.sh | ||
# Execute end-to-end (e2e) tests to verify that everything is working right | ||
# from the end user perpsective | ||
set -xeuo pipefail | ||
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. @carolynvs 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. It seems to be working fine, and it's super helpful to have the variable checking. Let me know if this is a must fix, otherwise I think it would be good to stick with |
||
|
||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )/.." | ||
|
||
# Use a version of Go that supports Go Modules | ||
export GO111MODULES=on | ||
GOMOD_CACHE=$(go env GOPATH)/src/mod | ||
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. @carolynvs Maybe you could just declare; clearGoModCache () {
# The sudo is a necessary workaround until go is fixed
sudo rm -fr $GOPATH/*
} ref: 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. I think this should be ignored until the change is in an official Go release as we do not work with go from tip. 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. Agreed, I'm explicitly using a tagged release, 1.11beta2 and would prefer to not try to follow tip. Once they tag a new release with that change, then yes we should update this to keep pace with the new location. I definitely do not want to do a |
||
GO_SOURCE=${GO_SOURCE:=$(go env GOPATH)/src/golang.org/x/go} | ||
export GOROOT=${GO_SOURCE} | ||
export PATH=${GO_SOURCE}/bin:${REPO_DIR}/bin:${PATH} | ||
go version | ||
|
||
clearGoModCache () { | ||
# The sudo is a necessary workaround until go is fixed | ||
sudo rm -fr ${GOMOD_CACHE} | ||
} | ||
|
||
teardown () { | ||
# Cleanup after our tests | ||
pkill buffalo || true | ||
popd 2> /dev/null || true | ||
} | ||
trap teardown EXIT | ||
|
||
# Start the proxy in the background and wait for it to be ready | ||
export GO_BINARY_PATH=${GO_SOURCE}/bin/go | ||
cd $REPO_DIR/cmd/proxy | ||
pkill buffalo || true # cleanup old buffalos | ||
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.
|
||
buffalo dev & | ||
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:3000)" != "200" ]]; do sleep 5; done | ||
|
||
# Clone our test repo | ||
TEST_SOURCE=${TMPDIR}go-depmgmt-testrepo | ||
rm -fr ${TEST_SOURCE} 2> /dev/null || true | ||
git clone https://github.com/carolynvs/go-depmgmt-testrepo.git ${TEST_SOURCE} | ||
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. We could consider adding this with #340 |
||
pushd ${TEST_SOURCE} | ||
|
||
clearGoModCache | ||
|
||
# Make sure that our test repo works without the GOPROXY first | ||
unset GOPROXY | ||
go run main.go | ||
|
||
clearGoModCache | ||
|
||
# Verify that the test works against the proxy | ||
export GOPROXY=http://localhost:3000 | ||
go run main.go |
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.
this escalated quickly 👍