Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test agains latest Scylla #4306

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/cfg/integration-test-cfg.yaml
Original file line number Diff line number Diff line change
@@ -46,13 +46,13 @@
tablets: enabled
ssl-enabled: false

- scylla-version: scylla:2025.1.0-rc3
ip-family: IPV4
- scylla-version: scylla-nightly:latest
ip-family: IPV6
raft-schema: none
tablets: disabled
ssl-enabled: true

- scylla-version: scylla:2025.1.0-rc3
- scylla-version: scylla-nightly:latest
ip-family: IPV4
raft-schema: none
tablets: enabled
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ concurrency:
cancel-in-progress: true
group: int-${{ github.workflow }}-${{ github.ref }}
env:
scylla-version: scylla:2025.1.0-rc3
scylla-version: scylla-nightly:2025.2.0-dev-0.20250310.f18e8edcb791
ip-family: IPV4
raft-schema: none
tablets: enabled
@@ -106,7 +106,7 @@ jobs:
run: make pkg-integration-test PKG=./pkg/store
- name: Run migrate tests
run: make pkg-integration-test PKG=./pkg/schema/migrate
name: integration-tests-2025.1.0-rc3-IPV4-tablets-nossl
name: integration-tests-latest-IPV4-tablets-nossl
"on":
pull_request:
types:
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@ concurrency:
cancel-in-progress: true
group: int-${{ github.workflow }}-${{ github.ref }}
env:
scylla-version: scylla:2025.1.0-rc3
ip-family: IPV4
scylla-version: scylla-nightly:2025.2.0-dev-0.20250310.f18e8edcb791
ip-family: IPV6
raft-schema: none
tablets: disabled
ssl-enabled: "true"
@@ -106,7 +106,7 @@ jobs:
run: make pkg-integration-test PKG=./pkg/store
- name: Run migrate tests
run: make pkg-integration-test PKG=./pkg/schema/migrate
name: integration-tests-2025.1.0-rc3-IPV4
name: integration-tests-latest-IPV6
"on":
pull_request:
types:
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ GIT_ROOT = $(shell git rev-parse --show-toplevel)
GOBIN ?= $(shell pwd)/bin
GOFILES = go list -f '{{range .GoFiles}}{{ $$.Dir }}/{{ . }} {{end}}{{range .TestGoFiles}}{{ $$.Dir }}/{{ . }} {{end}}' $(PKG)

SCYLLA_VERSION?=scylla:6.0.1
SCYLLA_VERSION?=scylla-nightly:latest
IP_FAMILY?=IPV4
RAFT_SCHEMA?=none
TABLETS?=enabled
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ Scylla Manager consists of tree components:
| **2024.1.12** | ![integration-tests-2024.1.12-IPV4]<br/>![integration-tests-2024.1.12-IPV6] | Restoration of schema into cluster with `consistant_cluster_management: true` is not supported |
| **2023.1.11** | ![integration-tests-2023.1.11-IPV4]<br/>![integration-tests-2023.1.11-IPV4-raftschema]<br/>![integration-tests-2023.1.11-IPV6-raftschema] | Restoration of schema into cluster with `consistant_cluster_management: true` is not supported |
| **6.2.0** | ![integration-tests-6.2.0-IPV4]<br/>![integration-tests-6.2.0-IPV4-tablets]<br/>![integration-tests-6.2.0-IPV6-tablets-nossl] | Restoration of **Authentication** and **Service Levels** is not supported<br/>Restoration of schema containing **Alternator** tables is not supported |
| **2025.1.0-rc3** | ![integration-tests-2025.1.0-rc3-IPV4]<br/>![integration-tests-2025.1.0-rc3-IPV4-tablets-nossl] | Restoration of **Authentication** and **Service Levels** is not supported<br/>Restoration of schema containing **Alternator** tables is not supported |
| **latest** | ![integration-tests-latest-IPV6]<br/>![integration-tests-latest-IPV4-tablets-nossl] | Restoration of **Authentication** and **Service Levels** is not supported<br/>Restoration of schema containing **Alternator** tables is not supported |

[integration-tests-2024.1.12-IPV4]: https://github.com/scylladb/scylla-manager/actions/workflows/integration-tests-2024.1.12-IPV4.yaml/badge.svg?branch=master
[integration-tests-2024.1.12-IPV6]: https://github.com/scylladb/scylla-manager/actions/workflows/integration-tests-2024.1.12-IPV6.yaml/badge.svg?branch=master
@@ -30,8 +30,8 @@ Scylla Manager consists of tree components:
[integration-tests-6.2.0-IPV4]: https://github.com/scylladb/scylla-manager/actions/workflows/integration-tests-6.2.0-IPV4.yaml/badge.svg?branch=master
[integration-tests-6.2.0-IPV4-tablets]: https://github.com/scylladb/scylla-manager/actions/workflows/integration-tests-6.2.0-IPV4-tablets.yaml/badge.svg?branch=master
[integration-tests-6.2.0-IPV6-tablets-nossl]: https://github.com/scylladb/scylla-manager/actions/workflows/integration-tests-6.2.0-IPV6-tablets-nossl.yaml/badge.svg?branch=master
[integration-tests-2025.1.0-rc3-IPV4]: https://github.com/scylladb/scylla-manager/actions/workflows/integration-tests-2025.1.0-rc3-IPV4.yaml/badge.svg?branch=master
[integration-tests-2025.1.0-rc3-IPV4-tablets-nossl]: https://github.com/scylladb/scylla-manager/actions/workflows/integration-tests-2025.1.0-rc3-IPV4-tablets-nossl.yaml/badge.svg?branch=master
[integration-tests-latest-IPV6]: https://github.com/scylladb/scylla-manager/actions/workflows/integration-tests-latest-IPV6.yaml/badge.svg?branch=master
[integration-tests-latest-IPV4-tablets-nossl]: https://github.com/scylladb/scylla-manager/actions/workflows/integration-tests-latest-IPV4-tablets-nossl.yaml/badge.svg?branch=master

## Installing and updating Go

47 changes: 37 additions & 10 deletions pkg/scyllaclient/client_scylla_integration_test.go
Original file line number Diff line number Diff line change
@@ -169,39 +169,66 @@ func TestClientActiveRepairsIntegration(t *testing.T) {
if err != nil {
t.Fatal(err)
}
hosts, err := client.Hosts(context.Background())
ni, err := client.AnyNodeInfo(context.Background())
if err != nil {
t.Fatal(err)
}
tabletAPI, err := ni.SupportsTabletRepairNoHostFiltering()
if err != nil {
t.Fatal(err)
}

Print("Given: cluster with table to repair")
const ks = "test_active_repairs_ks"
s := db.CreateSessionAndDropAllKeyspaces(t, client)
db.WriteData(t, s, ks, 1)

rd := scyllaclient.NewRingDescriber(context.Background(), client)
asyncRepair := func(ctx context.Context, ks, tab, master string) {
if _, err := client.RawRepair(ctx, ks, tab, master); err != nil {
t.Error(err)
}
}
if rd.IsTabletKeyspace(ks) && tabletAPI {
asyncRepair = func(ctx context.Context, ks, tab, master string) {
if _, err := client.TabletRepair(ctx, ks, tab, master); err != nil {
t.Error(err)
}
}
}

Print("When: cluster is idle")
Print("Then: no repairs are running")
active, err := client.ActiveRepairs(context.Background(), hosts)
active, err := client.ActiveRepairs(context.Background(), ManagedClusterHosts())
if err != nil {
t.Fatal(err)
}
if len(active) != 0 {
t.Fatal(active)
}

Print("When: repair is running on host 0")
Print("When: repair is running")
go func() {
ExecOnHost(hosts[0], "nodetool repair -pr")
asyncRepair(context.Background(), ks, db.BigTableName, ManagedClusterHost())
}()
defer func() {
if err := client.KillAllRepairs(context.Background(), hosts[0]); err != nil {
if err := client.KillAllRepairs(context.Background(), ManagedClusterHosts()...); err != nil {
t.Fatal(err)
}
}()

Print("Then: active repairs reports host 0")
WaitCond(t, func() bool {
active, err = client.ActiveRepairs(context.Background(), hosts)
Print("Then: active repairs reports")
cond := func() bool {
active, err = client.ActiveRepairs(context.Background(), ManagedClusterHosts())
if err != nil {
t.Fatal(err)
}
return cmp.Diff(active, hosts[0:1]) == ""
}, 500*time.Millisecond, 4*time.Second)
t.Logf("Active repairs: %v", active)
return len(active) == 1
}
if !cond() {
WaitCond(t, cond, 50*time.Millisecond, 4*time.Second)
}
}

func TestClientSnapshotIntegration(t *testing.T) {
15 changes: 15 additions & 0 deletions pkg/scyllaclient/export_test.go
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@ package scyllaclient
import (
"context"
"time"

"github.com/scylladb/scylla-manager/v3/swagger/gen/scylla/v1/client/operations"
)

func NoRetry(ctx context.Context) context.Context {
@@ -38,3 +40,16 @@ func (p *CachedProvider) SetValidity(d time.Duration) {
func (c *Client) Hosts(ctx context.Context) ([]string, error) {
return c.hosts(ctx)
}

func (c *Client) RawRepair(ctx context.Context, ks, tab, master string) (int32, error) {
p := operations.StorageServiceRepairAsyncByKeyspacePostParams{
Context: forceHost(ctx, master),
Keyspace: ks,
ColumnFamilies: &tab,
}
resp, err := c.scyllaOps.StorageServiceRepairAsyncByKeyspacePost(&p)
if err != nil {
return 0, err
}
return resp.GetPayload(), nil
}
10 changes: 5 additions & 5 deletions pkg/scyllaclient/retry_integration_test.go
Original file line number Diff line number Diff line change
@@ -101,11 +101,7 @@ func testRetry(t *testing.T, hosts []string, n int, shouldTimeout bool) error {
config := scyllaclient.TestConfig(hosts, AgentAuthToken())
config.Transport = hostRecorder(scyllaclient.DefaultTransport(), triedHosts)

ctx, cancel := context.WithTimeout(context.Background(), time.Duration(n+1)*config.Timeout)
defer cancel()
defer unblock(context.Background())

if err := block(ctx, hosts[0:n]); err != nil {
if err := block(context.Background(), hosts[0:n]); err != nil {
return err
}

@@ -114,6 +110,10 @@ func testRetry(t *testing.T, hosts []string, n int, shouldTimeout bool) error {
return err
}

ctx, cancel := context.WithTimeout(context.Background(), time.Duration(n+1)*config.Timeout)
defer cancel()
defer unblock(context.Background())

if _, err = client.Hosts(ctx); err != nil {
if shouldTimeout {
if !strings.HasSuffix(err.Error(), fmt.Sprintf("after %s: context deadline exceeded", client.Config().Timeout)) {
136 changes: 0 additions & 136 deletions pkg/service/backup/service_backup_integration_test.go
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ import (
"testing"
"time"

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

func TestBackupRestoreIntegration(t *testing.T) {
const (
testBucket = "backuptest-restore"
testKeyspace = "backuptest_restore"
)

location := s3Location(testBucket)
config := defaultConfig()

var (
session = CreateScyllaManagerDBSession(t)
h = newBackupTestHelper(t, session, config, location, nil)
ctx = context.Background()
clusterSession = CreateSessionAndDropAllKeyspaces(t, h.Client)
initialRowCount = 100
addedRowCount = 150
)

Print("When: cluster has data")
ExecStmt(t, clusterSession, "CREATE KEYSPACE IF NOT EXISTS "+testKeyspace+" WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 3, 'dc2': 3}")
ExecStmt(t, clusterSession, "CREATE TABLE IF NOT EXISTS "+testKeyspace+".test_table (id int PRIMARY KEY)")
for i := 1; i <= initialRowCount; i++ {
ExecStmt(t, clusterSession, "INSERT INTO "+testKeyspace+".test_table (id) VALUES "+fmt.Sprintf("(%d)", i))
}

target := backup.Target{
Units: []backup.Unit{
{
Keyspace: testKeyspace,
Tables: []string{"test_table"},
},
{
Keyspace: "system_schema",
AllTables: true,
},
},
DC: []string{"dc1", "dc2"},
Location: []backupspec.Location{location},
Retention: 3,
}
if err := h.service.InitTarget(ctx, h.ClusterID, &target); err != nil {
t.Fatal(err)
}

Print("And: run backup")
if err := h.service.Backup(ctx, h.ClusterID, h.TaskID, h.RunID, target); err != nil {
t.Fatal(err)
}

Print("Then: there is one backup")
items, err := h.service.List(ctx, h.ClusterID, []backupspec.Location{location}, backup.ListFilter{ClusterID: h.ClusterID})
if err != nil {
t.Fatal(err)
}
if len(items) != 1 {
t.Fatalf("List() = %v, expected one item", items)
}
item := items[0]
if len(item.SnapshotInfo) != 1 {
t.Fatalf("List() = %v, expected one SnapshotTag", items)
}
snapshotTag := item.SnapshotInfo[0].SnapshotTag

Print("And: add more data")
for i := initialRowCount + 1; i <= addedRowCount; i++ {
ExecStmt(t, clusterSession, "INSERT INTO "+testKeyspace+".test_table (id) VALUES "+fmt.Sprintf("(%d)", i))
}

Print("Then: there is 15 rows")
count := func() int {
c := 0
if err := clusterSession.Query("SELECT COUNT(*) FROM "+testKeyspace+".test_table;", nil).Scan(&c); err != nil {
t.Fatal("select count:", err)
}
return c
}
if c := count(); c != addedRowCount {
t.Errorf("SELECT COUNT(*) = %d, expected %d", c, addedRowCount)
}

Print("When: delete data")
q := clusterSession.Query("TRUNCATE "+testKeyspace+".test_table", nil)
q.Consistency(gocql.All)
if err := q.ExecRelease(); err != nil {
t.Fatal("TRUNCATE error", err)
}

Print("And: restore snapshot")
status, err := h.Client.Status(ctx)
if err != nil {
t.Fatal("Status() error", err)
}

for _, nis := range status {
stdout, stderr, err := ExecOnHost(nis.Addr, "chown scylla:scylla -R /var/lib/scylla/data/"+testKeyspace)
if err != nil {
t.Log("stdout", stdout)
t.Log("stderr", stderr)
t.Fatal("Command failed on host", nis.Addr, err)
}
}
downloadFilesCmd := []string{
"sudo -u scylla",
"scylla-manager-agent",
"download-files",
"-d", "/var/lib/scylla/data",
"-L", location.String(),
"-T", snapshotTag,
"-K", testKeyspace,
"--mode", "upload",
}
for _, nis := range status {
stdout, stderr, err := ExecOnHost(nis.Addr, strings.Join(downloadFilesCmd, " "))
if err != nil {
t.Log("stdout", stdout)
t.Log("err", err)
t.Log("stderr", stderr)
t.Fatal("Command failed on host", nis.Addr, err)
}
}
for _, nis := range status {
stdout, stderr, err := ExecOnHost(nis.Addr, "nodetool refresh "+testKeyspace+" test_table")
if err != nil {
t.Log("stdout", stdout)
t.Log("stderr", stderr)
t.Fatal("Command failed on host", nis.Addr, err)
}
}

Print("Then: there is previous number of rows")
if c := count(); c != initialRowCount {
t.Errorf("SELECT COUNT(*) = %d, expected %d", c, addedRowCount)
}
}

func TestBackupListIntegration(t *testing.T) {
const (
testBucket = "backuptest-list"
5 changes: 2 additions & 3 deletions pkg/service/healthcheck/service_integration_test.go
Original file line number Diff line number Diff line change
@@ -439,9 +439,6 @@ func testStatusIntegration(t *testing.T, clusterID uuid.UUID, clusterSvc cluster
})

t.Run("all nodes REST DOWN", func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

for _, h := range ManagedClusterHosts() {
BlockREST(t, h)
}
@@ -452,6 +449,8 @@ func testStatusIntegration(t *testing.T, clusterID uuid.UUID, clusterSvc cluster
}()

msg := ""
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if _, err := s.Status(ctx, clusterID); err != nil {
msg = err.Error()
}
4 changes: 2 additions & 2 deletions pkg/service/repair/service_repair_integration_test.go
Original file line number Diff line number Diff line change
@@ -1052,12 +1052,12 @@ func TestServiceRepairIntegration(t *testing.T) {
t.Fatal(err)
}

_, _, err = ExecOnHost(ignored, "sudo supervisorctl stop scylla")
_, _, err = ExecOnHost(ignored, "supervisorctl stop scylla")
if err != nil {
t.Fatal(err)
}
defer func() {
_, _, err := ExecOnHost(ignored, "sudo supervisorctl start scylla")
_, _, err := ExecOnHost(ignored, "supervisorctl start scylla")
if err != nil {
t.Fatal(err)
}
Loading