Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

exclusion of heavy/long/dependency requiring tests #1155

Closed
Dieterbe opened this issue Nov 28, 2018 · 0 comments
Closed

exclusion of heavy/long/dependency requiring tests #1155

Dieterbe opened this issue Nov 28, 2018 · 0 comments

Comments

@Dieterbe
Copy link
Contributor

  1. the tests in stacktest all require docker and docker-compose to run a stack. they also require make bin to have run.
  2. idx/cassandra has a few Benchmarks that CreateSession and require a cassandra to be running.

these tests are:
A) time consuming to always run
B) not trivial to get the context right. For 2 we could probably just use docker also though, and any dependency can basically solved this way, so that only problem 1 remains.

As for how to exclude tests, there seem to be 2 common approaches:
a) build tags: see https://stackoverflow.com/questions/24030059/skip-some-tests-with-go-test and https://medium.com/@povilasve/go-advanced-tips-tricks-a872503ac859
b) env vars: see https://peter.bourgon.org/go-for-industrial-programming/#testing, https://splice.com/blog/lesser-known-features-go-test/
c) short mode: https://golang.org/pkg/testing/#Short

some preliminary pros/cons after not much research:

  • b and c require more setup than a, which is mostly implicit.
  • a only on file level, whereas b is per function
  • b and c can provide feedback back to user, when -v is used. a has no feedback mechanism afaik.
  • according to peter bourgon's best practices long tests should be opt-in, which would rule out c. However, if the go developers made the short flag as to opt-out, then I rather go with how go is actually designed.

I think i would prefer c.

Dieterbe added a commit that referenced this issue Nov 29, 2018
clean way of skipping expensive and integration tests. fix #1155
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant