Skip to content

Commit

Permalink
Merge pull request #17026 from serathius/test-v3-storage-configuratio…
Browse files Browse the repository at this point in the history
…n-validation

Test v3 storage configuration validation
  • Loading branch information
serathius committed Nov 27, 2023
2 parents e1d7909 + fbdf65f commit e0b18a5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions server/etcdserver/api/membership/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,17 @@ func TestClusterValidateAndAssignIDs(t *testing.T) {
}
}

func TestClusterValidateConfigurationChange(t *testing.T) {
func TestClusterValidateConfigurationChangeV3(t *testing.T) {
testClusterValidateConfigurationChange(t, true)
}
func TestClusterValidateConfigurationChangeV2(t *testing.T) {
testClusterValidateConfigurationChange(t, false)
}

func testClusterValidateConfigurationChange(t *testing.T, shouldApplyV3 ShouldApplyV3) {
cl := NewCluster(zaptest.NewLogger(t), WithMaxLearners(1))
be := newMembershipBackend()
cl.SetBackend(be)
cl.SetStore(v2store.New())
for i := 1; i <= 4; i++ {
var isLearner bool
Expand Down Expand Up @@ -455,7 +464,7 @@ func TestClusterValidateConfigurationChange(t *testing.T) {
},
}
for i, tt := range tests {
err := cl.ValidateConfigurationChange(tt.cc, false)
err := cl.ValidateConfigurationChange(tt.cc, shouldApplyV3)
if err != tt.werr {
t.Errorf("#%d: validateConfigurationChange error = %v, want %v", i, err, tt.werr)
}
Expand Down

0 comments on commit e0b18a5

Please sign in to comment.