From 551149657e60d321950f54d07483ebd2cd2b1f2f Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Mon, 27 Aug 2018 11:42:27 +0200 Subject: [PATCH] test: test gofmt only with the latest go version since gofmt output may change between versions, only test gofmt with the latest (currently go1.11) go version. --- cmd/keeper/cmd/keeper_test.go | 12 +- cmd/sentinel/cmd/sentinel_test.go | 746 +++++++++++++++--------------- test | 11 +- 3 files changed, 384 insertions(+), 385 deletions(-) diff --git a/cmd/keeper/cmd/keeper_test.go b/cmd/keeper/cmd/keeper_test.go index edd6fb293..5be567531 100644 --- a/cmd/keeper/cmd/keeper_test.go +++ b/cmd/keeper/cmd/keeper_test.go @@ -122,7 +122,7 @@ func TestGenerateHBA(t *testing.T) { }{ { DefaultSUReplAccessMode: cluster.SUReplAccessAll, - dbUID: "db1", + dbUID: "db1", out: []string{ "local postgres superuser md5", "local replication repluser md5", @@ -136,7 +136,7 @@ func TestGenerateHBA(t *testing.T) { }, { DefaultSUReplAccessMode: cluster.SUReplAccessAll, - dbUID: "db2", + dbUID: "db2", out: []string{ "local postgres superuser md5", "local replication repluser md5", @@ -150,7 +150,7 @@ func TestGenerateHBA(t *testing.T) { }, { DefaultSUReplAccessMode: cluster.SUReplAccessAll, - dbUID: "db1", + dbUID: "db1", pgHBA: []string{ "host all all 192.168.0.0/24 md5", }, @@ -166,7 +166,7 @@ func TestGenerateHBA(t *testing.T) { }, { DefaultSUReplAccessMode: cluster.SUReplAccessAll, - dbUID: "db2", + dbUID: "db2", pgHBA: []string{ "host all all 192.168.0.0/24 md5", }, @@ -182,7 +182,7 @@ func TestGenerateHBA(t *testing.T) { }, { DefaultSUReplAccessMode: cluster.SUReplAccessStrict, - dbUID: "db1", + dbUID: "db1", out: []string{ "local postgres superuser md5", "local replication repluser md5", @@ -194,7 +194,7 @@ func TestGenerateHBA(t *testing.T) { }, { DefaultSUReplAccessMode: cluster.SUReplAccessStrict, - dbUID: "db2", + dbUID: "db2", out: []string{ "local postgres superuser md5", "local replication repluser md5", diff --git a/cmd/sentinel/cmd/sentinel_test.go b/cmd/sentinel/cmd/sentinel_test.go index 528ba3a07..28c060c0d 100644 --- a/cmd/sentinel/cmd/sentinel_test.go +++ b/cmd/sentinel/cmd/sentinel_test.go @@ -349,9 +349,9 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - InitMode: cluster.DBInitModeNew, - SynchronousReplication: false, + KeeperUID: "keeper1", + InitMode: cluster.DBInitModeNew, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: nil, @@ -447,12 +447,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -474,8 +474,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -537,12 +537,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -564,8 +564,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -630,11 +630,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -655,8 +655,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -718,11 +718,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: nil, @@ -738,11 +738,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper2", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper2", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: nil, @@ -805,11 +805,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -825,11 +825,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper2", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper2", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: nil, @@ -889,11 +889,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 3, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper2", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - Role: common.RoleMaster, + KeeperUID: "keeper2", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + Role: common.RoleMaster, SynchronousReplication: false, Followers: []string{"db3"}, SynchronousStandbys: nil, @@ -915,8 +915,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeResync, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db2", @@ -981,11 +981,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -1006,8 +1006,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -1069,11 +1069,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -1094,8 +1094,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -1160,11 +1160,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -1185,8 +1185,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -1248,11 +1248,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: nil, @@ -1268,11 +1268,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper2", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper2", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: nil, @@ -1343,12 +1343,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -1370,8 +1370,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -1441,12 +1441,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -1468,8 +1468,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -1542,11 +1542,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -1567,8 +1567,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -1638,11 +1638,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: nil, @@ -1663,8 +1663,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -1688,8 +1688,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeResync, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -1762,11 +1762,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: nil, @@ -1787,8 +1787,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -1812,8 +1812,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -1883,11 +1883,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 3, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db3"}, SynchronousStandbys: nil, @@ -1909,8 +1909,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -1975,12 +1975,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -2002,8 +2002,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -2065,12 +2065,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -2092,8 +2092,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -2158,12 +2158,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -2215,12 +2215,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: nil, @@ -2489,11 +2489,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -2514,8 +2514,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -2578,11 +2578,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: nil, @@ -2598,11 +2598,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper2", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: true, + KeeperUID: "keeper2", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: []string{}, @@ -2670,11 +2670,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: nil, @@ -2695,8 +2695,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -2759,11 +2759,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: false, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: false, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: nil, @@ -2779,11 +2779,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper2", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: true, + KeeperUID: "keeper2", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: []string{}, @@ -2850,11 +2850,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: []string{"db2"}, @@ -2876,8 +2876,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -2940,11 +2940,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: []string{"db2"}, @@ -2961,11 +2961,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper2", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: true, + KeeperUID: "keeper2", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: []string{"db1"}, @@ -3032,11 +3032,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: []string{"db2"}, @@ -3058,8 +3058,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3122,11 +3122,11 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2"}, SynchronousStandbys: []string{"db2"}, @@ -3148,8 +3148,8 @@ func TestUpdateCluster(t *testing.T) { MaxStandbys: cluster.DefaultMaxStandbys, AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3227,12 +3227,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db2"}, @@ -3255,8 +3255,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3280,8 +3280,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3352,12 +3352,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db2", "db3"}, @@ -3380,8 +3380,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3405,8 +3405,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3483,12 +3483,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db2", "db3"}, @@ -3511,8 +3511,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3536,8 +3536,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3608,12 +3608,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db2", "db3"}, @@ -3636,8 +3636,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3661,8 +3661,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3737,12 +3737,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db2", "db3"}, @@ -3766,8 +3766,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3791,8 +3791,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3863,12 +3863,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db2", "db3"}, @@ -3892,8 +3892,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3917,8 +3917,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -3995,12 +3995,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db2", "db3"}, @@ -4024,8 +4024,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4049,8 +4049,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4121,12 +4121,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 3, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db2"}, @@ -4150,8 +4150,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4175,8 +4175,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4251,12 +4251,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db2", "db3"}, @@ -4280,8 +4280,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4305,8 +4305,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4377,12 +4377,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 3, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db3"}, @@ -4406,8 +4406,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4431,8 +4431,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4509,12 +4509,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 3, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db3"}, @@ -4537,8 +4537,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4562,8 +4562,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4634,12 +4634,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 4, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: []string{"db3"}, @@ -4662,8 +4662,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4681,12 +4681,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper3", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper3", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: []string{"db1"}, @@ -4761,12 +4761,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 1, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{"db2", "db3"}, SynchronousStandbys: []string{"db2", "db3"}, @@ -4789,8 +4789,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4814,8 +4814,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4886,12 +4886,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper1", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper1", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: []string{"db2", "db3"}, @@ -4914,8 +4914,8 @@ func TestUpdateCluster(t *testing.T) { AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, InitMode: cluster.DBInitModeNone, SynchronousReplication: false, - Role: common.RoleStandby, - Followers: []string{}, + Role: common.RoleStandby, + Followers: []string{}, FollowConfig: &cluster.FollowConfig{ Type: cluster.FollowTypeInternal, DBUID: "db1", @@ -4933,12 +4933,12 @@ func TestUpdateCluster(t *testing.T) { Generation: 2, ChangeTime: time.Time{}, Spec: &cluster.DBSpec{ - KeeperUID: "keeper3", - RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, - MaxStandbys: cluster.DefaultMaxStandbys, - AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, - InitMode: cluster.DBInitModeNone, - SynchronousReplication: true, + KeeperUID: "keeper3", + RequestTimeout: cluster.Duration{Duration: cluster.DefaultRequestTimeout}, + MaxStandbys: cluster.DefaultMaxStandbys, + AdditionalWalSenders: cluster.DefaultAdditionalWalSenders, + InitMode: cluster.DBInitModeNone, + SynchronousReplication: true, Role: common.RoleMaster, Followers: []string{}, SynchronousStandbys: []string{"db1", "db2"}, diff --git a/test b/test index d01a90dfb..67a97538d 100755 --- a/test +++ b/test @@ -36,12 +36,11 @@ echo "Running tests..." COVER=${COVER:-"-cover"} -# Disable gofmt on CI since it'll break when we'll use go 1.10 and go 1.11 -# -# TODO(sgotti) Check against only one (usually the latest stable) go version -# gofmt output (for example gofmt in go 1.10 and 1.11 will format differently) -# or check that at least one passes -if [ "${CI}" != "true" ]; then +# Use only of specific go version to run gofmt since it'll break when we'll use go 1.10 and go 1.11 +GOFMT_VERSION="go1.11" + +MAJOR_GOVERSION=$( echo -n $(go version) | grep -o 'go1\.[0-9]*' || true ) +if [ "${MAJOR_GOVERSION}" == "${GOFMT_VERSION}" ]; then echo "Checking gofmt..." fmtRes=$(gofmt -l $(find . -type f -name '*.go' ! -path './vendor/*')) if [ -n "${fmtRes}" ]; then