From ec470f66bf0ad8738178c6b1ef9c6899f87f3987 Mon Sep 17 00:00:00 2001 From: Yonah Dissen Date: Tue, 19 Sep 2023 10:49:38 +0300 Subject: [PATCH] add tests for deploy structured --- pkg/kor/configmaps_test.go | 4 ++++ pkg/kor/deployments_test.go | 4 ++++ pkg/kor/services_test.go | 4 ++++ pkg/kor/statefulsets_test.go | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/pkg/kor/configmaps_test.go b/pkg/kor/configmaps_test.go index b7e5ac9a..3141c429 100644 --- a/pkg/kor/configmaps_test.go +++ b/pkg/kor/configmaps_test.go @@ -21,6 +21,10 @@ func createTestConfigmaps(t *testing.T) *fake.Clientset { ObjectMeta: metav1.ObjectMeta{Name: testNamespace}, }, metav1.CreateOptions{}) + if err != nil { + t.Fatalf("Error creating namespace %s: %v", testNamespace, err) + } + configmap1 := CreateTestConfigmap(testNamespace, "configmap-1") configmap2 := CreateTestConfigmap(testNamespace, "configmap-2") configmap3 := CreateTestConfigmap(testNamespace, "configmap-3") diff --git a/pkg/kor/deployments_test.go b/pkg/kor/deployments_test.go index 0806773e..bed7ec90 100644 --- a/pkg/kor/deployments_test.go +++ b/pkg/kor/deployments_test.go @@ -21,6 +21,10 @@ func createTestDeployments(t *testing.T) *fake.Clientset { ObjectMeta: v1.ObjectMeta{Name: testNamespace}, }, v1.CreateOptions{}) + if err != nil { + t.Fatalf("Error creating namespace %s: %v", testNamespace, err) + } + appLabels := map[string]string{} deployment1 := CreateTestDeployment(testNamespace, "test-deployment1", 0, appLabels) diff --git a/pkg/kor/services_test.go b/pkg/kor/services_test.go index 86312897..4db5901e 100644 --- a/pkg/kor/services_test.go +++ b/pkg/kor/services_test.go @@ -21,6 +21,10 @@ func createTestServices(t *testing.T) *fake.Clientset { ObjectMeta: v1.ObjectMeta{Name: testNamespace}, }, v1.CreateOptions{}) + if err != nil { + t.Fatalf("Error creating namespace %s: %v", testNamespace, err) + } + endpoint1 := CreateTestEndpoint(testNamespace, "test-endpoint1", 0) endpoint2 := CreateTestEndpoint(testNamespace, "test-endpoint2", 1) _, err = clientset.CoreV1().Endpoints(testNamespace).Create(context.TODO(), endpoint1, v1.CreateOptions{}) diff --git a/pkg/kor/statefulsets_test.go b/pkg/kor/statefulsets_test.go index 6e30142e..5fc3c915 100644 --- a/pkg/kor/statefulsets_test.go +++ b/pkg/kor/statefulsets_test.go @@ -21,6 +21,10 @@ func createTestStatefulSets(t *testing.T) *fake.Clientset { ObjectMeta: v1.ObjectMeta{Name: testNamespace}, }, v1.CreateOptions{}) + if err != nil { + t.Fatalf("Error creating namespace %s: %v", testNamespace, err) + } + appLabels := map[string]string{} sts1 := CreateTestStatefulSet(testNamespace, "test-sts1", 0, appLabels)