forked from kyma-project/infrastructure-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
191 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
internal/controller/runtime/fsm/runtime_fsm_delete_shoot_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package fsm | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
v1 "github.com/kyma-project/infrastructure-manager/api/v1" | ||
) | ||
|
||
func Test_addGardenerCloudDelConfirmation(t *testing.T) { | ||
instance := v1.Runtime{} | ||
actual := addGardenerCloudDelConfirmation(instance.Annotations) | ||
if _, found := actual[v1.AnnotationGardenerCloudDelConfirmation]; !found { | ||
t.Errorf("actual map should contain '%s' annotation", v1.AnnotationGardenerCloudDelConfirmation) | ||
} | ||
} | ||
|
||
func Test_IsGardenerCloudDelConfirmation(t *testing.T) { | ||
var cases = []struct { | ||
annotations map[string]string | ||
expected bool | ||
}{ | ||
{ | ||
expected: false, | ||
}, | ||
{ | ||
annotations: (map[string]string{}), | ||
expected: false, | ||
}, | ||
{ | ||
annotations: map[string]string{"test": "me"}, | ||
expected: false, | ||
}, | ||
{ | ||
annotations: map[string]string{ | ||
v1.AnnotationGardenerCloudDelConfirmation: "true", | ||
"test": "me", | ||
}, | ||
expected: true, | ||
}, | ||
{ | ||
annotations: map[string]string{ | ||
v1.AnnotationGardenerCloudDelConfirmation: "anything", | ||
"test": "me", | ||
}, | ||
expected: false, | ||
}, | ||
{ | ||
annotations: map[string]string{ | ||
v1.AnnotationGardenerCloudDelConfirmation: "", | ||
}, | ||
expected: false, | ||
}, | ||
} | ||
|
||
for i, tt := range cases { | ||
t.Run(fmt.Sprintf("case-%d", i), func(t *testing.T) { | ||
if actual := isGardenerCloudDelConfirmationSet(tt.annotations); actual != tt.expected { | ||
t.Errorf("expected IsGardenerCloudDelConfirmation == %t", | ||
tt.expected) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.