Browse the Repo

file-type-icon.circleci
file-type-icon_docs
file-type-iconexamples
file-type-iconmodules
file-type-icontest
file-type-iconGopkg.lock
file-type-iconGopkg.toml
file-type-iconempty_cluster_example_test.go
file-type-iconhelpers_aws.go
file-type-iconhelpers_file.go
file-type-iconhelpers_mongo.go
file-type-iconhelpers_tls.go
file-type-iconmongo_replica_set_with_backup_test.go
file-type-iconmongo_sharded_cluster_test.go
file-type-iconmongodb_single_instance_test.go
file-type-iconpacker_options.go
file-type-iconterratest_options.go
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md

Browse the Repo

file-type-icon.circleci
file-type-icon_docs
file-type-iconexamples
file-type-iconmodules
file-type-icontest
file-type-iconGopkg.lock
file-type-iconGopkg.toml
file-type-iconempty_cluster_example_test.go
file-type-iconhelpers_aws.go
file-type-iconhelpers_file.go
file-type-iconhelpers_mongo.go
file-type-iconhelpers_tls.go
file-type-iconmongo_replica_set_with_backup_test.go
file-type-iconmongo_sharded_cluster_test.go
file-type-iconmongodb_single_instance_test.go
file-type-iconpacker_options.go
file-type-iconterratest_options.go
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md
MongoDB

MongoDB

Deploy a MongoDB cluster. Supports replica sets, sharding, automated bootstrapping, backup, recovery, and OS optimizations.

Code Preview

Preview the Code

mobile file icon

helpers_file.go

down
  • package test
  • import (
  • "io/ioutil"
  • "os"
  • "testing"
  • "github.com/gruntwork-io/terratest/modules/files"
  • "github.com/gruntwork-io/terratest/modules/logger"
  • "github.com/gruntwork-io/terratest/modules/shell"
  • "github.com/stretchr/testify/require"
  • )
  • // NOTE: This code was mostly copied from https://github.com/gruntwork-io/vault-aws-blueprint/blob/master/test/file_helpers.go
  • // Copy the files in the given path to a temp folder and return the path to that temp folder. We do this so
  • // we can run tests in parallel on the same Terraform code without their state files overwriting each other.
  • func gitCloneRepoToTempFolder(t *testing.T, gitRepoUrl string) string {
  • logger.Logf(t, "Git cloning repo to access Gruntwork module tls-private-cert")
  • tmpPath, err := ioutil.TempDir("", "package-mongodb-test")
  • require.NoError(t, err)
  • cmd := shell.Command{
  • WorkingDir: tmpPath,

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?