Skip to content

Commit 0473c8a

Browse files
committed
fix tests
1 parent a2bb45b commit 0473c8a

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

internal/controllers/database/controller_test.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,12 @@ var _ = Describe("Database controller medium tests", func() {
308308
Expect(args).To(ContainElements([]string{"--grpc-public-address-v4", "--grpc-public-target-name-override"}))
309309
})
310310

311-
It("Check externalHost and externalPort GRPC Service field propagation", func() {
311+
It("Check externalPort GRPC Service field propagation", func() {
312312
By("Create test database")
313313
databaseSample = *testobjects.DefaultDatabase()
314314
Expect(k8sClient.Create(ctx, &databaseSample)).Should(Succeed())
315315

316-
checkPublicArgs := func(expectedGRPCHost, expectedGRPCPort string) error {
316+
checkPublicPortArg := func(expectedGRPCPort string) error {
317317
foundStatefulSet := appsv1.StatefulSet{}
318318
Eventually(func() error {
319319
return k8sClient.Get(ctx,
@@ -326,15 +326,6 @@ var _ = Describe("Database controller medium tests", func() {
326326
}, test.Timeout, test.Interval).Should(Succeed())
327327
podContainerArgs := foundStatefulSet.Spec.Template.Spec.Containers[0].Args
328328
for idx, argKey := range podContainerArgs {
329-
if argKey == "--grpc-public-host" {
330-
if podContainerArgs[idx+1] != expectedGRPCHost {
331-
return fmt.Errorf(
332-
"Found arg `--grpc-public-host` value %s does not match with expected: %s",
333-
podContainerArgs[idx+1],
334-
expectedGRPCHost,
335-
)
336-
}
337-
}
338329
if argKey == "--grpc-public-port" {
339330
if podContainerArgs[idx+1] != expectedGRPCPort {
340331
return fmt.Errorf(
@@ -349,9 +340,8 @@ var _ = Describe("Database controller medium tests", func() {
349340
}
350341

351342
By("Check that args `--grpc-public-host` and `--grpc-public-port` propagated to StatefulSet pods...")
352-
publicHost := fmt.Sprintf(v1alpha1.InterconnectServiceFQDNFormat, testobjects.DatabaseName, testobjects.YdbNamespace, v1alpha1.DefaultDomainName)
353343
Eventually(
354-
checkPublicArgs(fmt.Sprintf("%s.%s", "$(NODE_NAME)", publicHost), fmt.Sprintf("%d", v1alpha1.GRPCPort)),
344+
checkPublicPortArg(fmt.Sprintf("%d", v1alpha1.GRPCPort)),
355345
test.Timeout,
356346
test.Interval).ShouldNot(HaveOccurred())
357347

@@ -366,7 +356,7 @@ var _ = Describe("Database controller medium tests", func() {
366356
Expect(k8sClient.Update(ctx, &database)).Should(Succeed())
367357
})
368358

369-
By("Check that type and NodePort was updated for Database GRPC Service...")
359+
By("Check that type was updated for Database GRPC Service to NodePort...")
370360
Eventually(func() error {
371361
databaseGRPCService := corev1.Service{}
372362
Expect(k8sClient.Get(ctx, types.NamespacedName{
@@ -394,7 +384,7 @@ var _ = Describe("Database controller medium tests", func() {
394384

395385
By("Check that args `--grpc-public-port` was updated in StatefulSet...")
396386
Eventually(
397-
checkPublicArgs(fmt.Sprintf("%s.%s", "$(NODE_NAME)", publicHost), fmt.Sprintf("%d", externalPort)),
387+
checkPublicPortArg(fmt.Sprintf("%d", externalPort)),
398388
test.Timeout,
399389
test.Interval).ShouldNot(HaveOccurred())
400390
})

tests/e2e/smoke_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,10 @@ var _ = Describe("Operator smoke test", func() {
738738
Expect(k8sClient.Create(ctx, storageSample)).Should(Succeed())
739739
defer DeleteStorageSafely(ctx, k8sClient, storageSample)
740740
By("create database...")
741+
databaseSample.Spec.Nodes = 1
742+
databaseSample.Spec.NodeSelector = map[string]string{
743+
"topology.kubernetes.io/zone": "az-1",
744+
}
741745
databaseSample.Annotations = map[string]string{
742746
v1alpha1.AnnotationGRPCPublicHost: "localhost",
743747
}

0 commit comments

Comments
 (0)