From 54454492a87fa67d5d74e4adcd4e32d280718ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Leszczy=C5=84ski?= <2000michal@wp.pl> Date: Wed, 11 Sep 2024 11:54:19 +0200 Subject: [PATCH] feat(cluster_test): test empty --host in SM DB As it is possible that the --host field in SM DB is empty, we should test that this scenario does not break anything in SM. Tests https://github.com/scylladb/scylla-enterprise/issues/4692 --- .../cluster/service_integration_test.go | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pkg/service/cluster/service_integration_test.go b/pkg/service/cluster/service_integration_test.go index 497111acc..e70c6f18e 100644 --- a/pkg/service/cluster/service_integration_test.go +++ b/pkg/service/cluster/service_integration_test.go @@ -7,6 +7,7 @@ package cluster_test import ( "context" + "fmt" "net" "os" "strconv" @@ -580,6 +581,28 @@ func TestServiceStorageIntegration(t *testing.T) { } }) + t.Run("no --host in SM DB", func(t *testing.T) { + setup(t) + c := validCluster() + if err := s.PutCluster(ctx, c); err != nil { + t.Fatal(err) + } + + if err := session.Query(fmt.Sprintf("UPDATE cluster SET host = '' WHERE id = %s", c.ID), nil).ExecRelease(); err != nil { + t.Fatalf("remove --host from SM DB: %s", err) + } + + client, err := s.CreateClientNoCache(context.Background(), c.ID) + if err != nil { + t.Fatal(err) + } + for _, h := range ManagedClusterHosts() { + if _, err := client.HostRack(ctx, h); err != nil { + t.Fatalf("test client by getting rack of host %s: %s", h, err) + } + } + }) + t.Run("list nodes", func(t *testing.T) { setup(t)