Adding a test for deleting keysets

This commit is contained in:
Ole Markus With 2020-04-21 09:00:27 +02:00
parent 8bb078a4a8
commit 78e8d83d91
2 changed files with 18 additions and 0 deletions

View File

@ -73,6 +73,7 @@ go_test(
],
embed = [":go_default_library"],
deps = [
"//pkg/apis/kops:go_default_library",
"//pkg/pki:go_default_library",
"//util/pkg/vfs:go_default_library",
],

View File

@ -23,6 +23,7 @@ import (
"testing"
"time"
"k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/pki"
"k8s.io/kops/util/pkg/vfs"
)
@ -214,4 +215,20 @@ spec:
}
}
// Check that keyset gets deleted
{
keyset := &kops.Keyset{}
keyset.Name = "ca"
keyset.Spec.Type = kops.SecretTypeKeypair
s.DeleteKeysetItem(keyset, "237054359138908419352140518924933177492")
_, err := pathMap["memfs://tests/private/ca/237054359138908419352140518924933177492.key"].ReadFile()
pathMap["memfs://tests/private/ca/237054359138908419352140518924933177492.key"].ReadFile()
if err == nil {
t.Fatalf("File memfs://tests/private/ca/237054359138908419352140518924933177492.key still exists")
}
}
}