Skip to content

Commit

Permalink
Updated test to check variable scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
tleed5 committed Jan 11, 2024
1 parent 1c79812 commit 5a47d99
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3371,7 +3371,40 @@ func TestVariableResource(t *testing.T) {
}

if len(variableSet.Variables) != 7 {
t.Fatalf("Expected 7 variables to be created")
t.Fatalf("Expected 7 variables to be created.")
}

for _, variable := range variableSet.Variables {
switch variable.Name {
case "UnscopedVariable":
if !variable.Scope.IsEmpty() {
t.Fatalf("Expected UnscopedVariable to have no scope values.")
}
case "ActionScopedVariable":
if len(variable.Scope.Actions) == 0 {
t.Fatalf("Expected ActionScopedVariable to have action scope.")
}
case "ChannelScopedVariable":
if len(variable.Scope.Channels) == 0 {
t.Fatalf("Expected ChannelScopedVariable to have channel scope.")
}
case "EnvironmentScopedVariable":
if len(variable.Scope.Environments) == 0 {
t.Fatalf("Expected EnvironmentScopedVariable to have environment scope.")
}
case "MachineScopedVariable":
if len(variable.Scope.Machines) == 0 {
t.Fatalf("Expected MachineScopedVariable to have machine scope.")
}
case "ProcessScopedVariable":
if len(variable.Scope.ProcessOwners) == 0 {
t.Fatalf("Expected ProcessScopedVariable to have process scope.")
}
case "RoleScopedVariable":
if len(variable.Scope.Roles) == 0 {
t.Fatalf("Expected RoleScopedVariable to have role scope.")
}
}
}

return nil
Expand Down

0 comments on commit 5a47d99

Please sign in to comment.