Skip to content

Commit

Permalink
fix(scyllaclient_test): don't assume system_auth exists
Browse files Browse the repository at this point in the history
Starting with Scylla 6.0, system_auth is moved to system/system_auth_v2 and is handled by raft. New clusters won't have the old system_auth tables.
  • Loading branch information
Michal-Leszczynski committed May 22, 2024
1 parent 34defe1 commit f702253
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions pkg/scyllaclient/client_scylla_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,11 @@ func TestClientSnapshotIntegration(t *testing.T) {
ctx := context.Background()
host := ManagedClusterHost()
tag := "sm_" + timeutc.Now().Format("20060102150405") + "UTC"
const ks = "system_schema"
const tab = "tables"

Print("When: snapshot is taken")
if err := client.TakeSnapshot(ctx, host, tag, "system_auth"); err != nil {
if err := client.TakeSnapshot(ctx, host, tag, ks); err != nil {
t.Fatal(err)
}

Expand All @@ -216,12 +218,12 @@ func TestClientSnapshotIntegration(t *testing.T) {

Print("When: snapshot is taken again with the same tag")
Print("Then: nothing happens")
if err := client.TakeSnapshot(ctx, host, tag, "system_auth"); err != nil {
if err := client.TakeSnapshot(ctx, host, tag, ks); err != nil {
t.Fatal(err)
}

Print("When: table snapshot is removed")
if err := client.DeleteTableSnapshot(ctx, host, tag, "system_auth", "roles"); err != nil {
if err := client.DeleteTableSnapshot(ctx, host, tag, ks, tab); err != nil {
t.Fatal(err)
}

Expand All @@ -232,14 +234,14 @@ func TestClientSnapshotIntegration(t *testing.T) {
}
var u scyllaclient.Unit
for _, u = range units {
if u.Keyspace == "system_auth" {
if u.Keyspace == ks {
break
}
}
if u.Keyspace == "" {
t.Fatal("missing snapshot")
}
if slice.ContainsString(u.Tables, "roles") {
if slice.ContainsString(u.Tables, tab) {
t.Fatal("table snapshot not deleted")
}

Expand All @@ -259,6 +261,8 @@ func TestClientSnapshotIntegration(t *testing.T) {
}

func TestClientTableExistsIntegration(t *testing.T) {
const ks = "system_schema"
const tab = "tables"
table := []struct {
Name string
Keyspace string
Expand All @@ -267,13 +271,13 @@ func TestClientTableExistsIntegration(t *testing.T) {
}{
{
Name: "Valid",
Keyspace: "system_auth",
Table: "roles",
Keyspace: ks,
Table: tab,
Exists: true,
},
{
Name: "No table",
Keyspace: "system_auth",
Keyspace: ks,
Table: "aaa",
Exists: false,
},
Expand Down

0 comments on commit f702253

Please sign in to comment.