From 782c6c4d2369328583538262e2f1a656bfbd02a0 Mon Sep 17 00:00:00 2001 From: Anurag Mittal Date: Thu, 12 Dec 2024 08:59:00 +0100 Subject: [PATCH] fixup on test refactor --- pkg/driver/provisioner_server_impl_test.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pkg/driver/provisioner_server_impl_test.go b/pkg/driver/provisioner_server_impl_test.go index aa78bd65..989d34d6 100644 --- a/pkg/driver/provisioner_server_impl_test.go +++ b/pkg/driver/provisioner_server_impl_test.go @@ -320,9 +320,9 @@ var _ = Describe("ProvisionerServer DriverCreateBucket", Ordered, func() { var _ = Describe("FetchSecretInformation", Ordered, func() { var ( - parameters map[string]string - secretName string - namespace string + parameters map[string]string + secretName string + namespace string ) BeforeEach(func() { @@ -473,6 +473,17 @@ var _ = Describe("initializeObjectStorageClient", Ordered, func() { _, _, err = driver.InitializeClient(ctx, clientset, parameters, "IAM") Expect(status.Code(err)).To(Equal(codes.Internal)) }) + + It("should return error when FetchSecretInformation fails", func(ctx SpecContext) { + delete(parameters, "objectStorageSecretName") + + s3Client, s3Params, err := driver.InitializeClient(ctx, clientset, parameters, "S3") + Expect(s3Client).To(BeNil()) + Expect(s3Params).To(BeNil()) + Expect(err).To(HaveOccurred()) + Expect(status.Code(err)).To(Equal(codes.InvalidArgument)) + Expect(err.Error()).To(ContainSubstring("Object storage provider secret name and namespace are required")) + }) }) var _ = Describe("FetchParameters", Ordered, func() {