Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit a1f3c2c

Browse files
committed
server: Make --v2-deprecation=write-only the default and remove not-yet option
1 parent 986a2b5 commit a1f3c2c

3 files changed

Lines changed: 15 additions & 19 deletions

File tree

server/config/v2_deprecation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package config
1717
type V2DeprecationEnum string
1818

1919
const (
20-
// Default in v3.5. Issues a warning if v2store have meaningful content.
20+
// No longer supported in v3.6
2121
V2_DEPR_0_NOT_YET = V2DeprecationEnum("not-yet")
2222
// Default in v3.6. Meaningful v2 state is not allowed.
2323
// The V2 files are maintained for v3.5 rollback.
@@ -28,7 +28,7 @@ const (
2828
// ability to rollback to etcd v3.5.
2929
V2_DEPR_2_GONE = V2DeprecationEnum("gone")
3030

31-
V2_DEPR_DEFAULT = V2_DEPR_0_NOT_YET
31+
V2_DEPR_DEFAULT = V2_DEPR_1_WRITE_ONLY
3232
)
3333

3434
func (e V2DeprecationEnum) IsAtLeast(v2d V2DeprecationEnum) bool {

server/etcdmain/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ func newConfig() *config {
122122
proxyFlagOn,
123123
),
124124
v2deprecation: flags.NewSelectiveStringsValue(
125-
string(cconfig.V2_DEPR_0_NOT_YET),
126125
string(cconfig.V2_DEPR_1_WRITE_ONLY),
127126
string(cconfig.V2_DEPR_1_WRITE_ONLY_DROP),
128127
string(cconfig.V2_DEPR_2_GONE)),

tests/e2e/v2store_deprecation_test.go

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,6 @@ func createV2store(t testing.TB, lastReleaseBinary string, dataDirPath string) {
4444
}
4545
}
4646

47-
func assertVerifyCanStartV2deprecationNotYet(t testing.TB, dataDirPath string) {
48-
t.Log("verify: possible to start etcd with --v2-deprecation=not-yet mode")
49-
50-
cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{DataDirPath: dataDirPath, V2deprecation: "not-yet", KeepDataDir: true})
51-
epc, err := e2e.NewEtcdProcessCluster(t, cfg)
52-
assert.NoError(t, err)
53-
54-
defer func() {
55-
assert.NoError(t, epc.Stop())
56-
}()
57-
}
58-
5947
func assertVerifyCannotStartV2deprecationWriteOnly(t testing.TB, dataDirPath string) {
6048
t.Log("Verify its infeasible to start etcd with --v2-deprecation=write-only mode")
6149
proc, err := e2e.SpawnCmd([]string{e2e.BinDir + "/etcd", "--v2-deprecation=write-only", "--data-dir=" + dataDirPath}, nil)
@@ -65,6 +53,15 @@ func assertVerifyCannotStartV2deprecationWriteOnly(t testing.TB, dataDirPath str
6553
assert.NoError(t, err)
6654
}
6755

56+
func assertVerifyCannotStartV2deprecationNotYet(t testing.TB, dataDirPath string) {
57+
t.Log("Verify its infeasible to start etcd with --v2-deprecation=not-yet mode")
58+
proc, err := e2e.SpawnCmd([]string{e2e.BinDir + "/etcd", "--v2-deprecation=not-yet", "--data-dir=" + dataDirPath}, nil)
59+
assert.NoError(t, err)
60+
61+
_, err = proc.Expect(`invalid value "not-yet" for flag -v2-deprecation: invalid value "not-yet"`)
62+
assert.NoError(t, err)
63+
}
64+
6865
func TestV2Deprecation(t *testing.T) {
6966
e2e.BeforeTest(t)
7067
dataDirPath := t.TempDir()
@@ -78,12 +75,12 @@ func TestV2Deprecation(t *testing.T) {
7875
createV2store(t, lastReleaseBinary, dataDirPath)
7976
})
8077

81-
t.Run("--v2-deprecation=write-only fails", func(t *testing.T) {
82-
assertVerifyCannotStartV2deprecationWriteOnly(t, dataDirPath)
78+
t.Run("--v2-deprecation=not-yet fails", func(t *testing.T) {
79+
assertVerifyCannotStartV2deprecationNotYet(t, dataDirPath)
8380
})
8481

85-
t.Run("--v2-deprecation=not-yet succeeds", func(t *testing.T) {
86-
assertVerifyCanStartV2deprecationNotYet(t, dataDirPath)
82+
t.Run("--v2-deprecation=write-only fails", func(t *testing.T) {
83+
assertVerifyCannotStartV2deprecationWriteOnly(t, dataDirPath)
8784
})
8885

8986
}

0 commit comments

Comments
 (0)