This folder contains the tests for the modules in this repo.
Running the tests locally
Note #1: Many of these tests create real resources in an AWS account. That means they cost money to run, especially
if you don't clean up after yourself. Please be considerate of the resources you create and take extra care to clean
everything up when you're done!
Note #2: Never hit CTRL + C or cancel a build once tests are running or the cleanup tasks won't run!
Note #3: We set -timeout 45m on all tests not because they necessarily take 45 minutes, but because Go has a
default test timeout of 10 minutes, after which it does a SIGQUIT, preventing the tests from properly cleaning up
after themselves. Therefore, we set a timeout of 45 minutes to make sure all tests have enough time to finish and
cleanup.
Add your AWS credentials as environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
For some of the tests, you also need to set the GITHUB_OAUTH_TOKEN environment variable to a valid GitHub
auth token with "repo" access. You can generate one here: https://github.com/settings/tokens
Setup
Download Go dependencies using dep:
cdtest
dep ensure
Run all the tests
cdtest
go test -v -timeout 45m -parallel 128
Run a specific test
To run a specific test called TestFoo:
cdtest
go test -v -timeout 45m -parallel 128 -run TestFoo
Questions? Ask away.
We're here to talk about our services, answer any questions, give advice, or just to chat.
{"treedata":{"name":"root","toggled":true,"children":[{"name":".circleci","children":[{"name":"config.yml","path":".circleci/config.yml","sha":"d42916770a32367eeb0bd72acf7b068f30c34a74"}]},{"name":".gitignore","path":".gitignore","sha":"32845458602b36a63610885e236aecaf5d0cfb98"},{"name":".pre-commit-config.yaml","path":".pre-commit-config.yaml","sha":"40dde37cbe2716be382b51fccaabc08b113a5eba"},{"name":"CODEOWNERS","path":"CODEOWNERS","sha":"f6e0666fa0dee5df6743291167734a2bcfbb359b"},{"name":"LICENSE.txt","path":"LICENSE.txt","sha":"f4e3d9bd4717a044ed31ad847a300eee74371a78"},{"name":"README.md","path":"README.md","sha":"91e12b911d74229a4320aaeaadd2670240d04c08"},{"name":"examples","children":[{"name":"memcached","children":[{"name":"README.md","path":"examples/memcached/README.md","sha":"98ac13c3915c0ec564a5f493a5df38deec5d4e00"},{"name":"main.tf","path":"examples/memcached/main.tf","sha":"c19a437bd3ae931f4716b3835bda98f18064cb32"},{"name":"outputs.tf","path":"examples/memcached/outputs.tf","sha":"bc090567ef708bed42c4a64aaef937e8ae27b67a"},{"name":"vars.tf","path":"examples/memcached/vars.tf","sha":"2fd1a4649f52b1a66539b5f52d39107c87aabf14"}]},{"name":"redis","children":[{"name":"README.md","path":"examples/redis/README.md","sha":"cf0d093b9d434c17ff7817f5f7911c451175f135"},{"name":"main.tf","path":"examples/redis/main.tf","sha":"40ffd3368b33dd172f732ff28b89ef3d4be914d5"},{"name":"outputs.tf","path":"examples/redis/outputs.tf","sha":"fa63a3dda4e16c49e15f8f6c1185ea8acda463d6"},{"name":"vars.tf","path":"examples/redis/vars.tf","sha":"decc10c01d6965cd6896dce1e5cd6bae4c1696eb"}]},{"name":"redis_with_auth_token","children":[{"name":"README.md","path":"examples/redis_with_auth_token/README.md","sha":"1eff206d550be3a4eb3a6ca12cc700ac918d3679"},{"name":"main.tf","path":"examples/redis_with_auth_token/main.tf","sha":"72f186a92ad69dfa84a299cc449d7b61ba11f3fa"},{"name":"outputs.tf","path":"examples/redis_with_auth_token/outputs.tf","sha":"fa63a3dda4e16c49e15f8f6c1185ea8acda463d6"},{"name":"vars.tf","path":"examples/redis_with_auth_token/vars.tf","sha":"4bb8102242a9324ef9251ea3bd9aa57223b77c70"}]},{"name":"redis_with_sharding","children":[{"name":"README.md","path":"examples/redis_with_sharding/README.md","sha":"b17e9da01d802f21d5587be60961ff448a35f769"},{"name":"main.tf","path":"examples/redis_with_sharding/main.tf","sha":"40b359f5f92bb43a730efbd8a01f3da4d752b857"},{"name":"outputs.tf","path":"examples/redis_with_sharding/outputs.tf","sha":"b9da108a7b6c9d78ed439c31699fdd66abb83e0e"},{"name":"vars.tf","path":"examples/redis_with_sharding/vars.tf","sha":"266b3f3027fbc5ac570b481dca97a0885ec400db"}]}]},{"name":"modules","children":[{"name":"memcached","children":[{"name":"README.md","path":"modules/memcached/README.md","sha":"c5d3f4dc902f551347f460c0442ae8a0991ede04"},{"name":"main.tf","path":"modules/memcached/main.tf","sha":"df941719163e0f730a014fe22bb9ddb6ca3c8588"},{"name":"outputs.tf","path":"modules/memcached/outputs.tf","sha":"937ab3e0a846931270544fcf9c6020a6da7ff47d"},{"name":"vars.tf","path":"modules/memcached/vars.tf","sha":"26715675dd0be9c11e8a583d0746e08f1a179d8a"}]},{"name":"redis","children":[{"name":"README.md","path":"modules/redis/README.md","sha":"7220f78fb0dc2a2baf72637a581909bfe48f0ab3"},{"name":"main.tf","path":"modules/redis/main.tf","sha":"8ba839b7a051f6e020a9754796f20c963ea286a9"},{"name":"outputs.tf","path":"modules/redis/outputs.tf","sha":"f60f07c62fcb53e0c70d4f77f3162fc9596ca1c7"},{"name":"vars.tf","path":"modules/redis/vars.tf","sha":"23726b72dab63cf6a3681c2241e4df3d3eab75f2"}]}]},{"name":"terraform-cloud-enterprise-private-module-registry-placeholder.tf","path":"terraform-cloud-enterprise-private-module-registry-placeholder.tf","sha":"ae586c0fe830819580e1009d41a9074f16e65bed"},{"name":"test","children":[{"name":"README.md","path":"test/README.md","sha":"6b5235cc1168c5e09db7f1f1e22451d3d6d601db","toggled":true},{"name":"example_memcached_test.go","path":"test/example_memcached_test.go","sha":"6be05472a7dd8bcc82f0766af74351d7fb95fcd5"},{"name":"example_redis_test.go","path":"test/example_redis_test.go","sha":"b3c2a7899b7d877a0da3e5b41b5aef06746510fa"},{"name":"example_util_functions_test.go","path":"test/example_util_functions_test.go","sha":"ac6c2e63d5f870b3bf459d167061eb7cc7bfd751"},{"name":"go.mod","path":"test/go.mod","sha":"e296f23fcc49473a0fa0d2986ca8e89eed7f0f7a"},{"name":"go.sum","path":"test/go.sum","sha":"44590f91ad490ff50c4cbee598a94cc10fe4776b"}],"toggled":true}]},"detailsContent":"<h1 class=\"preview__body--title\" id=\"tests\">Tests</h1><div class=\"preview__body--border\"></div><p>This folder contains the tests for the modules in this repo.</p>\n<h2 class=\"preview__body--subtitle\" id=\"running-the-tests-locally\">Running the tests locally</h2>\n<p><strong>Note #1</strong>: Many of these tests create real resources in an AWS account. That means they cost money to run, especially\nif you don't clean up after yourself. Please be considerate of the resources you create and take extra care to clean\neverything up when you're done!</p>\n<p><strong>Note #2</strong>: Never hit <code>CTRL + C</code> or cancel a build once tests are running or the cleanup tasks won't run!</p>\n<p><strong>Note #3</strong>: We set <code>-timeout 45m</code> on all tests not because they necessarily take 45 minutes, but because Go has a\ndefault test timeout of 10 minutes, after which it does a <code>SIGQUIT</code>, preventing the tests from properly cleaning up\nafter themselves. Therefore, we set a timeout of 45 minutes to make sure all tests have enough time to finish and\ncleanup.</p>\n<h4 id=\"prerequisites\">Prerequisites</h4>\n<ul>\n<li>Install the latest version of <a href=\"https://golang.org/\" class=\"preview__body--description--blue\" target=\"_blank\">Go</a>.</li>\n<li>Install <a href=\"https://github.com/golang/dep\" class=\"preview__body--description--blue\" target=\"_blank\">dep</a> for Go dependency management. On OS X, the simplest way to install is\n<code>brew update; brew install dep</code>.</li>\n<li>Install <a href=\"https://www.terraform.io/downloads.html\" class=\"preview__body--description--blue\" target=\"_blank\">Terraform</a>.</li>\n<li>Add your AWS credentials as environment variables: <code>AWS_ACCESS_KEY_ID</code>, <code>AWS_SECRET_ACCESS_KEY</code></li>\n<li>For some of the tests, you also need to set the <code>GITHUB_OAUTH_TOKEN</code> environment variable to a valid GitHub\nauth token with "repo" access. You can generate one here: https://github.com/settings/tokens</li>\n</ul>\n<h4 id=\"setup\">Setup</h4>\n<p>Download Go dependencies using dep:</p>\n<pre><span class=\"hljs-built_in\">cd</span> <span class=\"hljs-built_in\">test</span>\ndep ensure\n</pre>\n<h4 id=\"run-all-the-tests\">Run all the tests</h4>\n<pre><span class=\"hljs-built_in\">cd</span> <span class=\"hljs-built_in\">test</span>\ngo <span class=\"hljs-built_in\">test</span> -v -timeout 45m -parallel 128\n</pre>\n<h4 id=\"run-a-specific-test\">Run a specific test</h4>\n<p>To run a specific test called <code>TestFoo</code>:</p>\n<pre><span class=\"hljs-keyword\">cd</span> <span class=\"hljs-keyword\">test</span>\ngo <span class=\"hljs-keyword\">test</span> -v -timeout 45m -parallel 128 -<span class=\"hljs-keyword\">run</span> TestFoo\n</pre>\n","repoName":"module-cache","repoRef":"v0.10.2","serviceDescriptor":{"serviceName":"Redis","serviceRepoName":"module-cache","serviceRepoOrg":"gruntwork-io","serviceMainReadmePath":"/modules/redis","cloudProviders":["aws"],"description":"Run a Redis cluster using Amazon’s ElastiCache Service. Supports replication, multi-zone automatic failover, and automatic backup.","imageUrl":"redis.png","licenseType":"subscriber","technologies":["Terraform","Bash"],"compliance":[],"tags":[""]},"serviceCategoryName":"NoSQL","fileName":"README.md","filePath":"/test","title":"Repo Browser: Redis","description":"Browse the repos in the Gruntwork Infrastructure as Code Library."}