diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2021-08-20 11:23:47 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2021-08-20 11:23:47 +0300 |
commit | 48d7984d9912c935a2c2abba3b55593cf0be2d8e (patch) | |
tree | a9eea43971ebe80a8f1dbb9329f1c443551ea879 /cmd | |
parent | 65f6b0541b63127484bada7a485c7dde20ae2f9a (diff) | |
parent | 1fcf22c1049579a1e9d5d4d1fcccfe1e37889028 (diff) |
Merge branch 'smh-dont-replicate-accept-dataloss' into 'master'
Don't schedule replication jobs in SetAuthoritativeStorage
See merge request gitlab-org/gitaly!3776
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/praefect/subcmd_accept_dataloss_test.go | 20 | ||||
-rw-r--r-- | cmd/praefect/subcmd_dataloss_test.go | 2 | ||||
-rw-r--r-- | cmd/praefect/subcmd_set_replication_factor_test.go | 2 |
3 files changed, 4 insertions, 20 deletions
diff --git a/cmd/praefect/subcmd_accept_dataloss_test.go b/cmd/praefect/subcmd_accept_dataloss_test.go index 8f8531833..cb3e9bf2b 100644 --- a/cmd/praefect/subcmd_accept_dataloss_test.go +++ b/cmd/praefect/subcmd_accept_dataloss_test.go @@ -2,7 +2,6 @@ package main import ( "context" - "fmt" "testing" "github.com/stretchr/testify/require" @@ -54,22 +53,7 @@ func TestAcceptDatalossSubcommand(t *testing.T) { require.NoError(t, rs.SetGeneration(ctx, vs, repo, storage, generation)) } - q := &datastore.MockReplicationEventQueue{ - EnqueueFunc: func(ctx context.Context, event datastore.ReplicationEvent) (datastore.ReplicationEvent, error) { - if event.Job.TargetNodeStorage == st2 { - return event, fmt.Errorf("replication event scheduled for authoritative storage %q", st2) - } - - generation, err := rs.GetGeneration(ctx, event.Job.VirtualStorage, event.Job.RelativePath, event.Job.SourceNodeStorage) - if err != nil { - return event, err - } - - return event, rs.SetGeneration(ctx, event.Job.VirtualStorage, event.Job.RelativePath, event.Job.TargetNodeStorage, generation) - }, - } - - ln, clean := listenAndServe(t, []svcRegistrar{registerPraefectInfoServer(info.NewServer(conf, q, rs, nil, nil, nil))}) + ln, clean := listenAndServe(t, []svcRegistrar{registerPraefectInfoServer(info.NewServer(conf, rs, nil, nil, nil))}) defer clean() conf.SocketPath = ln.Addr().String() @@ -152,7 +136,7 @@ func TestAcceptDatalossSubcommand(t *testing.T) { desc: "success", args: []string{"-virtual-storage=test-virtual-storage-1", "-repository=test-repository-1", "-authoritative-storage=test-physical-storage-2"}, matchError: matchNoError(), - expectedGenerations: map[string]int{st1: 2, st2: 2, st3: 2}, + expectedGenerations: map[string]int{st1: 1, st2: 2, st3: datastore.GenerationUnknown}, }, } { t.Run(tc.desc, func(t *testing.T) { diff --git a/cmd/praefect/subcmd_dataloss_test.go b/cmd/praefect/subcmd_dataloss_test.go index a66f69d11..19acc6459 100644 --- a/cmd/praefect/subcmd_dataloss_test.go +++ b/cmd/praefect/subcmd_dataloss_test.go @@ -80,7 +80,7 @@ func TestDatalossSubcommand(t *testing.T) { require.NoError(t, gs.SetGeneration(ctx, "virtual-storage-1", "repository-2", "gitaly-3", 0)) ln, clean := listenAndServe(t, []svcRegistrar{ - registerPraefectInfoServer(info.NewServer(cfg, nil, gs, nil, nil, nil))}) + registerPraefectInfoServer(info.NewServer(cfg, gs, nil, nil, nil))}) defer clean() for _, tc := range []struct { desc string diff --git a/cmd/praefect/subcmd_set_replication_factor_test.go b/cmd/praefect/subcmd_set_replication_factor_test.go index f55316de0..5b0d07605 100644 --- a/cmd/praefect/subcmd_set_replication_factor_test.go +++ b/cmd/praefect/subcmd_set_replication_factor_test.go @@ -96,7 +96,7 @@ func TestSetReplicationFactorSubcommand(t *testing.T) { ) ln, clean := listenAndServe(t, []svcRegistrar{registerPraefectInfoServer( - info.NewServer(config.Config{}, nil, nil, store, nil, nil), + info.NewServer(config.Config{}, nil, store, nil, nil), )}) defer clean() |