Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kovayur committed Jun 13, 2023
1 parent fe02904 commit ffd7fde
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions fleetshard/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,17 @@ func TestSingleton_Failure(t *testing.T) {

func TestSingleton_Success_WhenManagedDBEnabled(t *testing.T) {
t.Setenv("CLUSTER_ID", "some-value")
t.Setenv("AWS_ROLE_ARN", "arn:aws:iam::012456789:role/fake_role")
t.Setenv("MANAGED_DB_ENABLED", "true")
t.Setenv("MANAGED_DB_SECURITY_GROUP", "some-group")
cfg, err := GetConfig()
require.NoError(t, err)
assert.Equal(t, cfg.AWS.RoleARN, "arn:aws:iam::012456789:role/fake_role")
assert.Equal(t, cfg.AWS.Region, "us-east-1")
assert.Equal(t, cfg.ManagedDB.Enabled, true)
assert.Equal(t, cfg.ManagedDB.SecurityGroup, "some-group")
}

func TestSingleton_Failure_WhenManagedDBEnabledAndAWSRoleArnNotSet(t *testing.T) {
t.Setenv("CLUSTER_ID", "some-value")
t.Setenv("MANAGED_DB_ENABLED", "true")
t.Setenv("MANAGED_DB_SECURITY_GROUP", "some-group")
cfg, err := GetConfig()
assert.Error(t, err, "MANAGED_DB_ENABLED == true and AWS_ROLE_ARN unset in the environment")
assert.Nil(t, cfg)
}

func TestSingleton_Failure_WhenManagedDBEnabledAndManagedDbSecurityGroupNotSet(t *testing.T) {
t.Setenv("CLUSTER_ID", "some-value")
t.Setenv("MANAGED_DB_ENABLED", "true")
t.Setenv("AWS_ROLE_ARN", "arn:aws:iam::012456789:role/fake_role")
cfg, err := GetConfig()
assert.Error(t, err, "MANAGED_DB_ENABLED == true and MANAGED_DB_SECURITY_GROUP unset in the environment")
assert.Nil(t, cfg)
Expand Down

0 comments on commit ffd7fde

Please sign in to comment.