Skip to content

Commit

Permalink
create separate account for running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ianic committed Dec 4, 2021
1 parent 687241b commit 130cf2a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion kit/clitest/clitest.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func New(t TestingT) *Env {

showOnce.Do(func() {
if testing.Verbose() {
fmt.Printf(" cli commands output dir %s\n", outputDir)
fmt.Printf("cli output dir %s\n", outputDir)
}
})

Expand Down
16 changes: 10 additions & 6 deletions test/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ import (
)

const defaultNodeName = "unit-test"
const awsAccountID = "052548195718"

var (
cleanupWorkspace bool
awsCli *aws.AWS
//commandOutputPath func(testName, name string, arg ...string) string
awsAccountID string
)

func setAwsEnv() {
// org5 unit-test user
os.Setenv("AWS_ACCESS_KEY_ID", "AKIAQYPA52WDEUQBVW2V")
os.Setenv("AWS_SECRET_ACCESS_KEY", "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")
// unit-test user in unit-test aws account
awsAccountID = "418101788216"
os.Setenv("AWS_ACCESS_KEY_ID", "AKIAWCWGO7Y4OIY7X2UU")
os.Setenv("AWS_SECRET_ACCESS_KEY", "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")
os.Setenv("AWS_DEFAULT_REGION", "eu-central-1")
}

Expand All @@ -53,6 +53,10 @@ func setup() int {
panic(err)
}

// if node named unit-test exists in default workspace
// and that node is in the unit-test account
// it will be used instead of creating new
// to speed up startup
if !defaultNodeExists() {
if err := createNewWorkspace(); err != nil {
panic(err)
Expand Down Expand Up @@ -109,7 +113,7 @@ func createNewWorkspace() error {
}

os.Setenv(domain.EnvWorkspacePath, workspacePath)
fmt.Printf("setting workspace path to %s\n", workspacePath)
fmt.Printf("workspace path %s\n", workspacePath)

// create and store activation token for this workspace
jwt := secret.TokenForTests(domain.MachineID())
Expand Down

0 comments on commit 130cf2a

Please sign in to comment.