74 lines
2.3 KiB
Go
74 lines
2.3 KiB
Go
package test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/gruntwork-io/terratest/modules/ssh"
|
|
"github.com/gruntwork-io/terratest/modules/terraform"
|
|
)
|
|
|
|
func TestSpecific(t *testing.T) {
|
|
// in this test we are going to create a small server
|
|
t.Parallel()
|
|
category := "securitygroups"
|
|
directory := "specific"
|
|
region := "us-west-1"
|
|
owner := "terraform-ci@suse.com"
|
|
terraformOptions, keyPair := setup(t, category, directory, region, owner)
|
|
|
|
sshAgent := ssh.SshAgentWithKeyPair(t, keyPair.KeyPair)
|
|
defer sshAgent.Stop()
|
|
terraformOptions.SshAgent = sshAgent
|
|
defer teardown(t, category, directory, keyPair, sshAgent)
|
|
defer terraform.Destroy(t, terraformOptions)
|
|
terraform.InitAndApply(t, terraformOptions)
|
|
}
|
|
func TestInternal(t *testing.T) {
|
|
// in this test we are going to create a medium server
|
|
t.Parallel()
|
|
category := "securitygroups"
|
|
directory := "internal"
|
|
region := "us-west-1"
|
|
owner := "terraform-ci@suse.com"
|
|
terraformOptions, keyPair := setup(t, category, directory, region, owner)
|
|
|
|
sshAgent := ssh.SshAgentWithKeyPair(t, keyPair.KeyPair)
|
|
defer sshAgent.Stop()
|
|
terraformOptions.SshAgent = sshAgent
|
|
defer teardown(t, category, directory, keyPair, sshAgent)
|
|
defer terraform.Destroy(t, terraformOptions)
|
|
terraform.InitAndApply(t, terraformOptions)
|
|
}
|
|
func TestEgress(t *testing.T) {
|
|
// in this test we are going to create a large server
|
|
t.Parallel()
|
|
category := "securitygroups"
|
|
directory := "egress"
|
|
region := "us-west-1"
|
|
owner := "terraform-ci@suse.com"
|
|
terraformOptions, keyPair := setup(t, category, directory, region, owner)
|
|
|
|
sshAgent := ssh.SshAgentWithKeyPair(t, keyPair.KeyPair)
|
|
defer sshAgent.Stop()
|
|
terraformOptions.SshAgent = sshAgent
|
|
defer teardown(t, category, directory, keyPair, sshAgent)
|
|
defer terraform.Destroy(t, terraformOptions)
|
|
terraform.InitAndApply(t, terraformOptions)
|
|
}
|
|
func TestPublic(t *testing.T) {
|
|
// in this test we are going to create a extra large server
|
|
t.Parallel()
|
|
category := "securitygroups"
|
|
directory := "public"
|
|
region := "us-west-1"
|
|
owner := "terraform-ci@suse.com"
|
|
terraformOptions, keyPair := setup(t, category, directory, region, owner)
|
|
|
|
sshAgent := ssh.SshAgentWithKeyPair(t, keyPair.KeyPair)
|
|
defer sshAgent.Stop()
|
|
terraformOptions.SshAgent = sshAgent
|
|
defer teardown(t, category, directory, keyPair, sshAgent)
|
|
defer terraform.Destroy(t, terraformOptions)
|
|
terraform.InitAndApply(t, terraformOptions)
|
|
}
|