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

Run E2E tests during CI #363

Merged
merged 8 commits into from
Aug 3, 2018
Merged

Run E2E tests during CI #363

merged 8 commits into from
Aug 3, 2018

Conversation

carolynvs
Copy link
Contributor

@carolynvs carolynvs commented Jul 30, 2018

  • Add ./scripts/test_e2e.sh which builds a go program that relies on go modules using GOPROXY.
  • Add make test-e2e target and document it. It's important to run make setup-dev-env once, before running the tests.
  • Use the same setup for travis and local development for the storage services

Closes #353

@carolynvs
Copy link
Contributor Author

Oops, I think I dorked something up on this PR. Please ignore and I'll fix later.

@arschles
Copy link
Member

arschles commented Aug 1, 2018

Thanks @carolynvs ! Let me know if I can help on this in any way. These tests would be awesome to have in here 👍 🎉

@carolynvs carolynvs force-pushed the e2e branch 2 times, most recently from a8b634b to 058b009 Compare August 2, 2018 02:53
@codecov-io
Copy link

codecov-io commented Aug 2, 2018

Codecov Report

Merging #363 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54106b9...54ea3ef. Read the comment docs.

@carolynvs carolynvs changed the title [WIP] Run E2E tests during CI Run E2E tests during CI Aug 2, 2018
@carolynvs
Copy link
Contributor Author

@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! 😀

@carolynvs
Copy link
Contributor Author

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
Copy link
Member

Choose a reason for hiding this comment

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

this escalated quickly 👍

Copy link
Member

@michalpristas michalpristas left a comment

Choose a reason for hiding this comment

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

approved 💯 times

@michalpristas michalpristas added the testing improvements or changes to our test code label Aug 2, 2018
Copy link
Member

@komuw komuw left a 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
Copy link
Member

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:

  1. https://go-review.googlesource.com/c/go/+/126755

Copy link

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.

Copy link
Contributor Author

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
Copy link
Member

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

https://github.com/anordal/shellharden/blob/master/how_to_do_things_safely_in_bash.md#how-to-begin-a-bash-script

Copy link
Contributor Author

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
Copy link
Member

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}
Copy link

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

@carolynvs
Copy link
Contributor Author

I've updated the PR with the recent changes from master.

@michalpristas
Copy link
Member

@carolynvs i think this is good to go, do you plan to do any more changes?

@carolynvs
Copy link
Contributor Author

carolynvs commented Aug 3, 2018

This is ready to merge! I can’t, not a committee on this repo, so anyone who is feel free to :shipit:

@michalpristas
Copy link
Member

I'm just bringing this even with master and will merge

@ghost
Copy link

ghost commented Aug 3, 2018

Thanks, was just about to as well 😁 sorry @carolynvs I got distracted at work yesterday.

@michalpristas michalpristas merged commit f1efade into gomods:master Aug 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing improvements or changes to our test code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants