Skip to content

Commit

Permalink
fix(restore_test): make GetTarget tests work with enterprise
Browse files Browse the repository at this point in the history
Ent Scylla versions contain additional table "dicts" which cannot be found in OSS Scylla,
so it should be excluded when comparing GetTarget output with golden files.
  • Loading branch information
Michal-Leszczynski committed Jun 4, 2024
1 parent 6aeb3d0 commit b396b56
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 96 deletions.
5 changes: 3 additions & 2 deletions pkg/service/backup/service_backup_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (h *backupTestHelper) setInterceptorBlockEndpointOnFirstHost(method string,
if req.Method == method && req.URL.Path == path {
mu.Lock()
defer mu.Unlock()

if brokenHost == "" {
h.T.Log("Setting broken host", req.Host)
brokenHost = req.Host
Expand Down Expand Up @@ -430,7 +430,8 @@ func TestGetTargetIntegration(t *testing.T) {
if diff := cmp.Diff(golden, v,
cmpopts.SortSlices(func(a, b string) bool { return a < b }),
cmpopts.IgnoreUnexported(backup.Target{}),
cmpopts.IgnoreSliceElements(func(u backup.Unit) bool { return u.Keyspace == "system_replicated_keys" })); diff != "" {
cmpopts.IgnoreSliceElements(func(u backup.Unit) bool { return u.Keyspace == "system_replicated_keys" }),
cmpopts.IgnoreSliceElements(func(t string) bool { return t == "dicts" })); diff != "" {
t.Fatal(diff)
}
})
Expand Down
3 changes: 2 additions & 1 deletion pkg/service/repair/service_repair_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@ func TestServiceGetTargetIntegration(t *testing.T) {
cmpopts.SortSlices(func(a, b string) bool { return a < b }),
cmpopts.SortSlices(func(u1, u2 repair.Unit) bool { return u1.Keyspace < u2.Keyspace }),
cmpopts.IgnoreUnexported(repair.Target{}),
cmpopts.IgnoreSliceElements(func(u repair.Unit) bool { return u.Keyspace == "system_replicated_keys" })); diff != "" {
cmpopts.IgnoreSliceElements(func(u repair.Unit) bool { return u.Keyspace == "system_replicated_keys" }),
cmpopts.IgnoreSliceElements(func(t string) bool { return t == "dicts" })); diff != "" {
t.Fatal(diff)
}
})
Expand Down
3 changes: 2 additions & 1 deletion pkg/service/restore/service_restore_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ func TestRestoreGetTargetUnitsViewsIntegration(t *testing.T) {
cmpopts.SortSlices(func(a, b Table) bool { return a.Table < b.Table }),
cmpopts.IgnoreFields(Unit{}, "Size"),
cmpopts.IgnoreFields(Table{}, "Size"),
cmpopts.IgnoreSliceElements(func(u Unit) bool { return u.Keyspace == "system_replicated_keys" })); diff != "" {
cmpopts.IgnoreSliceElements(func(u Unit) bool { return u.Keyspace == "system_replicated_keys" }),
cmpopts.IgnoreSliceElements(func(t Table) bool { return t.Table == "dicts" })); diff != "" {
t.Fatal(tc.units, diff)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"!ks1.mv1",
"!ks2.si1_index"
],
"snapshot_tag": "sm_20231109110956UTC",
"snapshot_tag": "sm_20240520084025UTC",
"batch_size": 2,
"restore_tables": true,
"continue": false
Expand Down
94 changes: 55 additions & 39 deletions pkg/service/restore/testdata/get_target/continue_false.units.json
Original file line number Diff line number Diff line change
@@ -1,70 +1,80 @@
[
{
"keyspace": "ks1",
"size": 15078072,
"keyspace": "system_traces",
"size": 0,
"tables": [
{
"table": "table2",
"table": "sessions",
"tombstone_gc": "timeout",
"size": 7539036
"size": 0
},
{
"table": "table1",
"table": "events",
"tombstone_gc": "timeout",
"size": 0
},
{
"table": "node_slow_log",
"tombstone_gc": "timeout",
"size": 0
},
{
"table": "node_slow_log_time_idx",
"tombstone_gc": "timeout",
"size": 7539036
"size": 0
},
{
"table": "sessions_time_idx",
"tombstone_gc": "timeout",
"size": 0
}
]
},
{
"keyspace": "ks2",
"size": 15078060,
"keyspace": "ks1",
"size": 12942864,
"tables": [
{
"table": "table1",
"tombstone_gc": "timeout",
"size": 7539030
"tombstone_gc": "repair",
"size": 6471432
},
{
"table": "table2",
"tombstone_gc": "timeout",
"size": 7539030
"tombstone_gc": "repair",
"size": 6471432
}
]
},
{
"keyspace": "system_auth",
"size": 104226,
"keyspace": "ks2",
"size": 12942858,
"tables": [
{
"table": "role_permissions",
"tombstone_gc": "timeout",
"size": 70848
},
{
"table": "roles",
"tombstone_gc": "timeout",
"size": 33378
},
{
"table": "role_members",
"tombstone_gc": "timeout",
"size": 0
"table": "table1",
"tombstone_gc": "repair",
"size": 6471432
},
{
"table": "role_attributes",
"tombstone_gc": "timeout",
"size": 0
"table": "table2",
"tombstone_gc": "repair",
"size": 6471426
}
]
},
{
"keyspace": "system_distributed",
"size": 187103,
"size": 185891,
"tables": [
{
"table": "view_build_status",
"tombstone_gc": "timeout",
"size": 187103
"size": 185891
},
{
"table": "dicts",
"tombstone_gc": "timeout",
"size": 0
},
{
"table": "service_levels",
Expand All @@ -74,31 +84,37 @@
]
},
{
"keyspace": "system_traces",
"keyspace": "system_replicated_keys",
"size": 0,
"tables": [
{
"table": "sessions_time_idx",
"table": "encrypted_keys",
"tombstone_gc": "timeout",
"size": 0
},
}
]
},
{
"keyspace": "system_auth",
"size": 0,
"tables": [
{
"table": "sessions",
"table": "role_attributes",
"tombstone_gc": "timeout",
"size": 0
},
{
"table": "node_slow_log_time_idx",
"table": "roles",
"tombstone_gc": "timeout",
"size": 0
},
{
"table": "node_slow_log",
"table": "role_permissions",
"tombstone_gc": "timeout",
"size": 0
},
{
"table": "events",
"table": "role_members",
"tombstone_gc": "timeout",
"size": 0
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[
{
"keyspace": "ks1",
"view": "mv1",
"type": "MaterializedView",
"base_table": "table1",
"create_stmt": "CREATE MATERIALIZED VIEW IF NOT EXISTS ks1.mv1 AS\n SELECT *\n FROM ks1.table1\n WHERE data IS NOT null\n PRIMARY KEY (id, data)\n WITH CLUSTERING ORDER BY (data ASC)\n AND bloom_filter_fp_chance = 0.01\n AND caching = {'keys':'ALL','rows_per_partition':'ALL'}\n AND comment = ''\n AND compaction = {'class':'IncrementalCompactionStrategy'}\n AND compression = {'sstable_compression':'org.apache.cassandra.io.compress.LZ4Compressor'}\n AND crc_check_chance = 1\n AND dclocal_read_repair_chance = 0\n AND default_time_to_live = 0\n AND gc_grace_seconds = 864000\n AND max_index_interval = 2048\n AND memtable_flush_period_in_ms = 0\n AND min_index_interval = 128\n AND read_repair_chance = 0\n AND speculative_retry = '99.0PERCENTILE'"
},
{
"keyspace": "ks2",
"view": "si1",
"type": "SecondaryIndex",
"base_table": "table2",
"create_stmt": "CREATE INDEX IF NOT EXISTS si1 ON ks2.table2 (data)"
},
{
"keyspace": "ks1",
"view": "mv1",
"type": "MaterializedView",
"base_table": "table1",
"create_stmt": "CREATE MATERIALIZED VIEW IF NOT EXISTS ks1.mv1 AS\n SELECT *\n FROM ks1.table1\n WHERE data IS NOT null\n PRIMARY KEY (id, data)\n WITH CLUSTERING ORDER BY (data ASC)\n AND bloom_filter_fp_chance = 0.01\n AND caching = {'keys':'ALL','rows_per_partition':'ALL'}\n AND comment = ''\n AND compaction = {'class':'SizeTieredCompactionStrategy'}\n AND compression = {'sstable_compression':'org.apache.cassandra.io.compress.LZ4Compressor'}\n AND crc_check_chance = 1\n AND dclocal_read_repair_chance = 0\n AND default_time_to_live = 0\n AND gc_grace_seconds = 864000\n AND max_index_interval = 2048\n AND memtable_flush_period_in_ms = 0\n AND min_index_interval = 128\n AND read_repair_chance = 0\n AND speculative_retry = '99.0PERCENTILE'"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"!ks1.mv1",
"!ks2.si1_index"
],
"snapshot_tag": "sm_20231109110956UTC",
"snapshot_tag": "sm_20240520084025UTC",
"batch_size": 2,
"restore_tables": true,
"continue": true
Expand Down
92 changes: 54 additions & 38 deletions pkg/service/restore/testdata/get_target/default_values.units.json
Original file line number Diff line number Diff line change
@@ -1,104 +1,120 @@
[
{
"keyspace": "system_distributed",
"size": 187103,
"tables": [
{
"table": "view_build_status",
"tombstone_gc": "timeout",
"size": 187103
},
{
"table": "service_levels",
"tombstone_gc": "timeout",
"size": 0
}
]
},
{
"keyspace": "system_traces",
"size": 0,
"tables": [
{
"table": "sessions_time_idx",
"table": "sessions",
"tombstone_gc": "timeout",
"size": 0
},
{
"table": "sessions",
"table": "events",
"tombstone_gc": "timeout",
"size": 0
},
{
"table": "node_slow_log_time_idx",
"table": "node_slow_log",
"tombstone_gc": "timeout",
"size": 0
},
{
"table": "node_slow_log",
"table": "node_slow_log_time_idx",
"tombstone_gc": "timeout",
"size": 0
},
{
"table": "events",
"table": "sessions_time_idx",
"tombstone_gc": "timeout",
"size": 0
}
]
},
{
"keyspace": "ks1",
"size": 15078072,
"size": 12942864,
"tables": [
{
"table": "table2",
"tombstone_gc": "timeout",
"size": 7539036
"table": "table1",
"tombstone_gc": "repair",
"size": 6471432
},
{
"table": "table1",
"tombstone_gc": "timeout",
"size": 7539036
"table": "table2",
"tombstone_gc": "repair",
"size": 6471432
}
]
},
{
"keyspace": "ks2",
"size": 15078060,
"size": 12942858,
"tables": [
{
"table": "table1",
"tombstone_gc": "timeout",
"size": 7539030
"tombstone_gc": "repair",
"size": 6471432
},
{
"table": "table2",
"tombstone_gc": "repair",
"size": 6471426
}
]
},
{
"keyspace": "system_distributed",
"size": 185891,
"tables": [
{
"table": "view_build_status",
"tombstone_gc": "timeout",
"size": 185891
},
{
"table": "dicts",
"tombstone_gc": "timeout",
"size": 7539030
"size": 0
},
{
"table": "service_levels",
"tombstone_gc": "timeout",
"size": 0
}
]
},
{
"keyspace": "system_replicated_keys",
"size": 0,
"tables": [
{
"table": "encrypted_keys",
"tombstone_gc": "timeout",
"size": 0
}
]
},
{
"keyspace": "system_auth",
"size": 104226,
"size": 0,
"tables": [
{
"table": "role_permissions",
"table": "role_attributes",
"tombstone_gc": "timeout",
"size": 70848
"size": 0
},
{
"table": "roles",
"tombstone_gc": "timeout",
"size": 33378
"size": 0
},
{
"table": "role_members",
"table": "role_permissions",
"tombstone_gc": "timeout",
"size": 0
},
{
"table": "role_attributes",
"table": "role_members",
"tombstone_gc": "timeout",
"size": 0
}
Expand Down
Loading

0 comments on commit b396b56

Please sign in to comment.