Commit Graph

5 Commits

Author SHA1 Message Date
Radek Simko 9e7e4ff4fb
e2e: Decouple logic for running e2e tests 2017-08-16 18:20:13 +02:00
Martin Atkins 23f9c8785e command/e2etest: an initial test for the primary workflow
This e2etest runs an init, plan, apply, destroy sequence against a test
configuration using the real template and null providers downloaded from
the official repository.

This test _does_ trample a bit on the scope of some already-existing
tests, but this is mainly just to check our assumptions about how
Terraform behaves to ensure that we can reach our main conclusion here:
that the main Terraform workflow commands interact correctly with each
other in real use and we can complete the full workflow.
2017-07-17 14:25:33 -07:00
Martin Atkins 52df81ee49 command/e2etest: test that we can install provider plugins
We already have good tests for the business logic around provider
installation, but the existing tests all stub out the main repository
server. This test completes that coverage by verifying that the installer
is able to run against the real repository and install an official release
of the template provider.
2017-07-17 14:25:33 -07:00
Martin Atkins 0e0b0d125a command/e2etest: "terraform version" test
This basic test is here primarily because it's one of the few that can
run without reaching out to external services, and so it means our usual
test runs will catch situations where the main executable build is
somehow broken.

The version command itself is not very interesting to test, but it's
convenient in that its behavior is very predictable and self-contained.
2017-07-17 14:25:33 -07:00
Martin Atkins fee61a44b4 command/e2etest: end-to-end testing harness
Previously we had no automated testing of whether we can produce a
Terraform executable that actually works. Our various functional tests
have good coverage of specific Terraform features and whole operations,
but we lacked end-to-end testing of actual usage of the generated binary,
without any stubbing.

This package is intended as a vehicle for such end-to-end testing. When
run normally under "go test" it will produce a build of the main Terraform
binary and make it available for tests to execute. The harness exposes
a flag for whether tests are allowed to reach out to external network
services, controlled with our standard TF_ACC environment variable, so
that basic local tests can be safely run as part of "make test" while
more elaborate tests can be run easily when desired.

It also provides a separate mode of operation where the included script
make-archive.sh can be used to produce a self-contained test archive that
can be copied to another system to run the tests there. This is intended
to allow testing of cross-compiled binaries, by shipping them over to
the target OS and architecture to run without requiring a full Go compiler
installation on the target system.

The goal here is not to test again functionality that's already
well-covered by our existing tests, but rather to test chains of normal
operations against the build binary that are not otherwise tested
together.
2017-07-17 14:25:33 -07:00