Skip to content

Commit 49b961f

Browse files
chore(backup_test): remove TestBackupRestoreIntegration
We haven't been supporting ansible script restore for a long time, so we don't need to keep on testing it.
1 parent dcc5610 commit 49b961f

File tree

1 file changed

+0
-136
lines changed

1 file changed

+0
-136
lines changed

pkg/service/backup/service_backup_integration_test.go

-136
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"testing"
2121
"time"
2222

23-
"github.com/gocql/gocql"
2423
"github.com/google/go-cmp/cmp"
2524
"github.com/google/go-cmp/cmp/cmpopts"
2625
"github.com/pkg/errors"
@@ -2120,141 +2119,6 @@ func TestValidateIntegration(t *testing.T) {
21202119
}
21212120
}
21222121

2123-
func TestBackupRestoreIntegration(t *testing.T) {
2124-
const (
2125-
testBucket = "backuptest-restore"
2126-
testKeyspace = "backuptest_restore"
2127-
)
2128-
2129-
location := s3Location(testBucket)
2130-
config := defaultConfig()
2131-
2132-
var (
2133-
session = CreateScyllaManagerDBSession(t)
2134-
h = newBackupTestHelper(t, session, config, location, nil)
2135-
ctx = context.Background()
2136-
clusterSession = CreateSessionAndDropAllKeyspaces(t, h.Client)
2137-
initialRowCount = 100
2138-
addedRowCount = 150
2139-
)
2140-
2141-
Print("When: cluster has data")
2142-
ExecStmt(t, clusterSession, "CREATE KEYSPACE IF NOT EXISTS "+testKeyspace+" WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 3, 'dc2': 3}")
2143-
ExecStmt(t, clusterSession, "CREATE TABLE IF NOT EXISTS "+testKeyspace+".test_table (id int PRIMARY KEY)")
2144-
for i := 1; i <= initialRowCount; i++ {
2145-
ExecStmt(t, clusterSession, "INSERT INTO "+testKeyspace+".test_table (id) VALUES "+fmt.Sprintf("(%d)", i))
2146-
}
2147-
2148-
target := backup.Target{
2149-
Units: []backup.Unit{
2150-
{
2151-
Keyspace: testKeyspace,
2152-
Tables: []string{"test_table"},
2153-
},
2154-
{
2155-
Keyspace: "system_schema",
2156-
AllTables: true,
2157-
},
2158-
},
2159-
DC: []string{"dc1", "dc2"},
2160-
Location: []backupspec.Location{location},
2161-
Retention: 3,
2162-
}
2163-
if err := h.service.InitTarget(ctx, h.ClusterID, &target); err != nil {
2164-
t.Fatal(err)
2165-
}
2166-
2167-
Print("And: run backup")
2168-
if err := h.service.Backup(ctx, h.ClusterID, h.TaskID, h.RunID, target); err != nil {
2169-
t.Fatal(err)
2170-
}
2171-
2172-
Print("Then: there is one backup")
2173-
items, err := h.service.List(ctx, h.ClusterID, []backupspec.Location{location}, backup.ListFilter{ClusterID: h.ClusterID})
2174-
if err != nil {
2175-
t.Fatal(err)
2176-
}
2177-
if len(items) != 1 {
2178-
t.Fatalf("List() = %v, expected one item", items)
2179-
}
2180-
item := items[0]
2181-
if len(item.SnapshotInfo) != 1 {
2182-
t.Fatalf("List() = %v, expected one SnapshotTag", items)
2183-
}
2184-
snapshotTag := item.SnapshotInfo[0].SnapshotTag
2185-
2186-
Print("And: add more data")
2187-
for i := initialRowCount + 1; i <= addedRowCount; i++ {
2188-
ExecStmt(t, clusterSession, "INSERT INTO "+testKeyspace+".test_table (id) VALUES "+fmt.Sprintf("(%d)", i))
2189-
}
2190-
2191-
Print("Then: there is 15 rows")
2192-
count := func() int {
2193-
c := 0
2194-
if err := clusterSession.Query("SELECT COUNT(*) FROM "+testKeyspace+".test_table;", nil).Scan(&c); err != nil {
2195-
t.Fatal("select count:", err)
2196-
}
2197-
return c
2198-
}
2199-
if c := count(); c != addedRowCount {
2200-
t.Errorf("SELECT COUNT(*) = %d, expected %d", c, addedRowCount)
2201-
}
2202-
2203-
Print("When: delete data")
2204-
q := clusterSession.Query("TRUNCATE "+testKeyspace+".test_table", nil)
2205-
q.Consistency(gocql.All)
2206-
if err := q.ExecRelease(); err != nil {
2207-
t.Fatal("TRUNCATE error", err)
2208-
}
2209-
2210-
Print("And: restore snapshot")
2211-
status, err := h.Client.Status(ctx)
2212-
if err != nil {
2213-
t.Fatal("Status() error", err)
2214-
}
2215-
2216-
for _, nis := range status {
2217-
stdout, stderr, err := ExecOnHost(nis.Addr, "chown scylla:scylla -R /var/lib/scylla/data/"+testKeyspace)
2218-
if err != nil {
2219-
t.Log("stdout", stdout)
2220-
t.Log("stderr", stderr)
2221-
t.Fatal("Command failed on host", nis.Addr, err)
2222-
}
2223-
}
2224-
downloadFilesCmd := []string{
2225-
"su scylla -c",
2226-
"scylla-manager-agent",
2227-
"download-files",
2228-
"-d", "/var/lib/scylla/data",
2229-
"-L", location.String(),
2230-
"-T", snapshotTag,
2231-
"-K", testKeyspace,
2232-
"--mode", "upload",
2233-
}
2234-
for _, nis := range status {
2235-
stdout, stderr, err := ExecOnHost(nis.Addr, strings.Join(downloadFilesCmd, " "))
2236-
if err != nil {
2237-
t.Log("stdout", stdout)
2238-
t.Log("err", err)
2239-
t.Log("stderr", stderr)
2240-
t.Fatal("Command failed on host", nis.Addr, err)
2241-
}
2242-
}
2243-
for _, nis := range status {
2244-
stdout, stderr, err := ExecOnHost(nis.Addr, "nodetool refresh "+testKeyspace+" test_table")
2245-
if err != nil {
2246-
t.Log("stdout", stdout)
2247-
t.Log("stderr", stderr)
2248-
t.Fatal("Command failed on host", nis.Addr, err)
2249-
}
2250-
}
2251-
2252-
Print("Then: there is previous number of rows")
2253-
if c := count(); c != initialRowCount {
2254-
t.Errorf("SELECT COUNT(*) = %d, expected %d", c, addedRowCount)
2255-
}
2256-
}
2257-
22582122
func TestBackupListIntegration(t *testing.T) {
22592123
const (
22602124
testBucket = "backuptest-list"

0 commit comments

Comments
 (0)