Skip to content

Commit

Permalink
testing: update compose to support dual network + updated int-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karol-kokoszka committed Jun 14, 2023
1 parent 838fbd6 commit 171d20b
Show file tree
Hide file tree
Showing 36 changed files with 284 additions and 204 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ integration-test:
# Load Minio config for INTEGRATION_TEST_ARGS
include testing/.env

INTEGRATION_TEST_ARGS := -cluster 192.168.100.100 \
-managed-cluster 192.168.100.11,192.168.100.12,192.168.100.13,192.168.100.21,192.168.100.22,192.168.100.23 \
-managed-second-cluster 192.168.100.30 \
INTEGRATION_TEST_ARGS := -cluster 192.168.200.100 \
-managed-cluster 192.168.200.11,192.168.200.12,192.168.200.13,192.168.200.21,192.168.200.22,192.168.200.23 \
-managed-second-cluster 192.168.200.30 \
-user cassandra -password cassandra \
-agent-auth-token token \
-s3-data-dir ./testing/minio/data -s3-provider Minio -s3-endpoint $(MINIO_ENDPOINT) -s3-access-key-id $(MINIO_USER_ACCESS_KEY) -s3-secret-access-key $(MINIO_USER_SECRET_KEY)
Expand All @@ -122,7 +122,7 @@ pkg-integration-test:
@docker kill scylla_manager_server 2> /dev/null || true
@CGO_ENABLED=0 GOOS=linux go test -tags integration -c -o ./integration-test.dev $(PKG)
@docker run --name "scylla_manager_server" \
--network scylla_manager_public \
--network host \
-v "/tmp:/tmp" \
-v "$(PWD)/integration-test.dev:/usr/bin/integration-test:ro" \
-v "$(PWD)/testing:/integration-test/testing" \
Expand Down Expand Up @@ -174,11 +174,12 @@ build-server: ## Build development server
.PHONY: run-server
run-server: build-server ## Build and run development server
@docker run --name "scylla_manager_server" \
--network scylla_manager_public \
--network scylla_manager_second --network scylla_manager_public \
-p "5080:5080" \
-p "5443:5443" \
-p "5090:5090" \
-v "$(PWD)/scylla-manager.dev:/usr/bin/scylla-manager:ro" \
-v "$(PWD)/sctool.dev:/usr/bin/sctool:ro" \
-v "$(PWD)/testing/scylla-manager/scylla-manager.yaml:/etc/scylla-manager/scylla-manager.yaml:ro" \
-v "/tmp:/tmp" \
-i --read-only --rm scylladb/scylla-manager-dev scylla-manager
Expand Down
33 changes: 30 additions & 3 deletions pkg/ping/cqlping/cqlping_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,26 @@ import (
"testing"
"time"

"github.com/scylladb/go-log"
"github.com/scylladb/scylla-manager/v3/pkg/ping"
"github.com/scylladb/scylla-manager/v3/pkg/scyllaclient"
"github.com/scylladb/scylla-manager/v3/pkg/service/cluster"
"github.com/scylladb/scylla-manager/v3/pkg/testutils"
"github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"go.uber.org/zap/zapcore"
)

func TestPingIntegration(t *testing.T) {
user, password := testutils.ManagedClusterCredentials()
client := newTestClient(t, log.NewDevelopmentWithLevel(zapcore.InfoLevel).Named("client"), nil)

sessionHosts, err := cluster.GetRPCAddresses(context.Background(), client, []string{db.ManagedClusterHost()})
if err != nil {
t.Fatal(err)
}

user, password := db.ManagedClusterCredentials()
config := Config{
Addr: testutils.ManagedClusterHost() + ":9042",
Addr: sessionHosts[0],
Timeout: 250 * time.Millisecond,
}

Expand Down Expand Up @@ -54,7 +66,7 @@ func TestPingTLSIntegration(t *testing.T) {
t.SkipNow()

config := Config{
Addr: testutils.ManagedClusterHost() + ":9042",
Addr: db.ManagedClusterHost() + ":9042",
Timeout: 250 * time.Millisecond,
TLSConfig: &tls.Config{
InsecureSkipVerify: true,
Expand All @@ -77,3 +89,18 @@ func TestPingTLSIntegration(t *testing.T) {
t.Logf("QueryPing() = %s", d)
})
}

func newTestClient(t *testing.T, logger log.Logger, config *scyllaclient.Config) *scyllaclient.Client {
t.Helper()

if config == nil {
c := scyllaclient.TestConfig(db.ManagedClusterHosts(), testutils.AgentAuthToken())
config = &c
}

c, err := scyllaclient.NewClient(*config, logger)
if err != nil {
t.Fatal(err)
}
return c
}
13 changes: 0 additions & 13 deletions pkg/ping/cqlping/main_test.go

This file was deleted.

5 changes: 3 additions & 2 deletions pkg/ping/dynamoping/dynamoping_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import (
"testing"
"time"

"github.com/scylladb/scylla-manager/v3/pkg/testutils"
_ "github.com/scylladb/scylla-manager/v3/pkg/testutils"
"github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
)

func TestPingIntegration(t *testing.T) {
config := Config{
Addr: "http://" + testutils.ManagedClusterHost() + ":8000",
Addr: "http://" + db.ManagedClusterHost() + ":8000",
Timeout: 250 * time.Millisecond,
}

Expand Down
13 changes: 0 additions & 13 deletions pkg/ping/dynamoping/main_test.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/scylladb/gocqlx/v2/migrate"
"github.com/scylladb/gocqlx/v2/qb"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"github.com/scylladb/scylla-manager/v3/pkg/util/uuid"
"github.com/scylladb/scylla-manager/v3/schema"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/scylladb/gocqlx/v2"
"github.com/scylladb/gocqlx/v2/migrate"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"github.com/scylladb/scylla-manager/v3/schema"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/scylladb/gocqlx/v2"
"github.com/scylladb/gocqlx/v2/qb"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"github.com/scylladb/scylla-manager/v3/schema"

"github.com/scylladb/gocqlx/v2/migrate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/scylladb/gocqlx/v2"
"github.com/scylladb/gocqlx/v2/migrate"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"github.com/scylladb/scylla-manager/v3/schema"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/scylladb/gocqlx/v2"
"github.com/scylladb/gocqlx/v2/migrate"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"github.com/scylladb/scylla-manager/v3/schema"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/scylladb/gocqlx/v2"
"github.com/scylladb/gocqlx/v2/qb"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"github.com/scylladb/scylla-manager/v3/schema"

"github.com/scylladb/gocqlx/v2/migrate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/scylladb/gocqlx/v2"
"github.com/scylladb/gocqlx/v2/migrate"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"github.com/scylladb/scylla-manager/v3/schema"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/schema/migrate/migrate_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/scylladb/go-log"
"github.com/scylladb/gocqlx/v2"
"github.com/scylladb/gocqlx/v2/migrate"
"github.com/scylladb/scylla-manager/v3/pkg/testutils"
"github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"github.com/scylladb/scylla-manager/v3/schema"
)

Expand All @@ -40,7 +40,7 @@ func testCallback(t *testing.T, ev migrate.CallbackEvent, name string, prepare,

saveRegister()
defer restoreRegister()
session := testutils.CreateSessionWithoutMigration(t)
session := db.CreateSessionWithoutMigration(t)

reg.Add(ev, name, func(ctx context.Context, session gocqlx.Session, ev migrate.CallbackEvent, name string) error {
if err := prepare(session); err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/scyllaclient/client_ping_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/scylladb/go-log"
"github.com/scylladb/scylla-manager/v3/pkg/scyllaclient"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
)

func TestCheckHostsConnectivityIntegration(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions pkg/scyllaclient/client_rclone_agent_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/scylladb/go-log"
"github.com/scylladb/scylla-manager/v3/pkg/scyllaclient"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
)

var longPollingTimeoutSeconds = 1
Expand Down
13 changes: 7 additions & 6 deletions pkg/scyllaclient/client_scylla_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/scylladb/go-set/i64set"
"github.com/scylladb/scylla-manager/v3/pkg/scyllaclient"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"github.com/scylladb/scylla-manager/v3/pkg/util/slice"
"github.com/scylladb/scylla-manager/v3/pkg/util/timeutc"
)
Expand Down Expand Up @@ -47,12 +48,12 @@ func TestClientStatusIntegration(t *testing.T) {
}

golden := scyllaclient.NodeStatusInfoSlice{
{Datacenter: "dc1", Addr: "192.168.100.11", State: "", Status: true},
{Datacenter: "dc1", Addr: "192.168.100.12", State: "", Status: true},
{Datacenter: "dc1", Addr: "192.168.100.13", State: "", Status: true},
{Datacenter: "dc2", Addr: "192.168.100.21", State: "", Status: true},
{Datacenter: "dc2", Addr: "192.168.100.22", State: "", Status: true},
{Datacenter: "dc2", Addr: "192.168.100.23", State: "", Status: true},
{Datacenter: "dc1", Addr: "192.168.200.11", State: "", Status: true},
{Datacenter: "dc1", Addr: "192.168.200.12", State: "", Status: true},
{Datacenter: "dc1", Addr: "192.168.200.13", State: "", Status: true},
{Datacenter: "dc2", Addr: "192.168.200.21", State: "", Status: true},
{Datacenter: "dc2", Addr: "192.168.200.22", State: "", Status: true},
{Datacenter: "dc2", Addr: "192.168.200.23", State: "", Status: true},
}

if diff := cmp.Diff(status, golden, cmpopts.IgnoreFields(scyllaclient.NodeStatusInfo{}, "HostID")); diff != "" {
Expand Down
1 change: 1 addition & 0 deletions pkg/scyllaclient/retry_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/scylladb/go-log"
"github.com/scylladb/scylla-manager/v3/pkg/scyllaclient"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"github.com/scylladb/scylla-manager/v3/pkg/util/httpx"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/service/backup/progress_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"

"github.com/scylladb/scylla-manager/v3/pkg/schema/table"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/db"
"github.com/scylladb/scylla-manager/v3/pkg/util/uuid"
)

Expand Down
Loading

0 comments on commit 171d20b

Please sign in to comment.