-
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
Conversation
Oops, I think I dorked something up on this PR. Please ignore and I'll fix later. |
Thanks @carolynvs ! Let me know if I can help on this in any way. These tests would be awesome to have in here 👍 🎉 |
Don't error out if it's been cloned already
a8b634b
to
058b009
Compare
Codecov Report
@@ Coverage Diff @@
## master #363 +/- ##
=======================================
Coverage 39.94% 39.94%
=======================================
Files 99 99
Lines 2671 2671
=======================================
Hits 1067 1067
Misses 1505 1505
Partials 99 99 Continue to review full report at Codecov.
|
@arschles Ok! I've gotten our travis and local dev setup more consistent and a very simple end-to-end test passing. Someone may prefer to rewrite it in Go, vs Bash, but this at least gets us some coverage for now! 😀 |
At some point we may be able to use gimme go1.11beta2 in our travis config instead of building go from source, I didn't want to make that jump at this time though. I'm pretty sure we may need to make more changes once start building Athens using go 1.11 |
- mongodb | ||
- postgresql | ||
- redis-server | ||
- docker |
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 👍
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.
approved 💯 times
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.
awesome.
|
||
# 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 comment
The reason will be displayed to describe this comment to others. Learn more.
@carolynvs
In Go1.11beta the location of the module cache is $GOPATH/src/mod
However on tip the location has changed to $GOPATH/pkg/mod
[1]
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 comment
The 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 comment
The 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 rm -fr $GOPATH/*
though, and just stick to nuking the mod cache directory, as this is something that should be safe for a dev to run locally as well as run on Travis.
# 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 comment
The reason will be displayed to describe this comment to others. Learn more.
@carolynvs
I do not know what version of bash travisCI uses,
but Bash version 4.3 and older doesn't handle set -u
very well in some circumstances(arrays)
But I don't think you are using arrays so, this may be fine
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.
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 -u
.
# 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 comment
The reason will be displayed to describe this comment to others. Learn more.
cleanup old buffalos
😄
# 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 comment
The reason will be displayed to describe this comment to others. Learn more.
We could consider adding this with #340
I've updated the PR with the recent changes from master. |
@carolynvs i think this is good to go, do you plan to do any more changes? |
This is ready to merge! I can’t, not a committee on this repo, so anyone who is feel free to |
I'm just bringing this even with master and will merge |
Thanks, was just about to as well 😁 sorry @carolynvs I got distracted at work yesterday. |
./scripts/test_e2e.sh
which builds a go program that relies on go modules using GOPROXY.make test-e2e
target and document it. It's important to runmake setup-dev-env
once, before running the tests.Closes #353