Skip to content

Commit 000970d

Browse files
committed
fix: downstream split node
Signed-off-by: matttrach <matt.trachier@suse.com>
1 parent 6f9162b commit 000970d

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

test/tests/downstream/basic_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func TestDownstreamBasic(t *testing.T) {
3434
exampleDir := filepath.Join(repoRoot, "examples", directory)
3535
testDir := filepath.Join(repoRoot, "test/tests/data", id)
3636
pluginsDir := filepath.Join(testDir, "plugins")
37-
// relTestDir := "."
3837

3938
err = util.CreateTestDirectories(t, id)
4039
if err != nil {
@@ -65,6 +64,7 @@ func TestDownstreamBasic(t *testing.T) {
6564
}
6665
t.Fatalf("Error creating test key pair: %s", err)
6766
}
67+
6868
sshAgent := ssh.SshAgentWithKeyPair(t, keyPairObj)
6969
t.Logf("Key %s created and added to agent", keyPairName)
7070

@@ -99,7 +99,7 @@ func TestDownstreamBasic(t *testing.T) {
9999
terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
100100
TerraformDir: exampleDir,
101101
// Variables to pass to our Terraform code using -var options
102-
Vars: map[string]interface{}{
102+
Vars: map[string]any{
103103
"identifier": id,
104104
"owner": owner,
105105
"key_name": keyPairName,
@@ -114,7 +114,6 @@ func TestDownstreamBasic(t *testing.T) {
114114
"aws_region": region,
115115
"acme_server_url": acme_server_url,
116116
"downstream_node_config": "all-in-one-dev-node-config",
117-
// "data_dir": relTestDir,
118117
},
119118
// Environment variables to set when running Terraform
120119
EnvVars: map[string]string{

test/tests/downstream/splitrole_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package downstream
33
import (
44
"os"
55
"path/filepath"
6+
"strings"
67
"testing"
78

89
aws "github.com/gruntwork-io/terratest/modules/aws"
@@ -30,9 +31,9 @@ func TestDownstreamSplitrole(t *testing.T) {
3031
t.Fatalf("Error getting git root directory: %v", err)
3132
}
3233

33-
exampleDir := repoRoot + "/examples/" + directory
34-
testDir := repoRoot + "/test/tests/data/" + id
35-
pluginsDir := filepath.Join(repoRoot, "test/tests/data", id, "plugins")
34+
exampleDir := filepath.Join(repoRoot, "examples", directory)
35+
testDir := filepath.Join(repoRoot, "test/tests/data", id)
36+
pluginsDir := filepath.Join(testDir, "plugins")
3637

3738
err = util.CreateTestDirectories(t, id)
3839
if err != nil {
@@ -52,7 +53,7 @@ func TestDownstreamSplitrole(t *testing.T) {
5253
}
5354
keyPairObj := keyPair.KeyPair
5455
privateKey := keyPairObj.PrivateKey
55-
publicKey := keyPairObj.PublicKey
56+
publicKey := strings.TrimSuffix(keyPairObj.PublicKey, "\n")
5657
keyPairName := keyPair.Name
5758

5859
err = os.WriteFile(testDir+"/id_rsa", []byte(privateKey), 0600)
@@ -113,7 +114,6 @@ func TestDownstreamSplitrole(t *testing.T) {
113114
"aws_region": region,
114115
"acme_server_url": acme_server_url,
115116
"downstream_node_config": "split-role-node-config",
116-
"data_dir": testDir,
117117
},
118118
// Environment variables to set when running Terraform
119119
EnvVars: map[string]string{
@@ -123,7 +123,7 @@ func TestDownstreamSplitrole(t *testing.T) {
123123
"TF_PLUGIN_CACHE_DIR": pluginsDir,
124124
"TF_IN_AUTOMATION": "1",
125125
"KUBECONFIG": testDir + "/kubeconfig",
126-
"KUBE_CONFIG_PATH": testDir,
126+
"KUBE_CONFIG_PATH": testDir + "/kubeconfig",
127127
"TF_CLI_ARGS_plan": "-no-color -state=" + testDir + "/tfstate",
128128
"TF_CLI_ARGS_apply": "-no-color -state=" + testDir + "/tfstate",
129129
"TF_CLI_ARGS_destroy": "-no-color -state=" + testDir + "/tfstate",

0 commit comments

Comments
 (0)