server: Make --v2-deprecation=write-only the default and remove not-yet option
parent
986a2b51f4
commit
a1f3c2c7cc
|
@ -17,7 +17,7 @@ package config
|
|||
type V2DeprecationEnum string
|
||||
|
||||
const (
|
||||
// Default in v3.5. Issues a warning if v2store have meaningful content.
|
||||
// No longer supported in v3.6
|
||||
V2_DEPR_0_NOT_YET = V2DeprecationEnum("not-yet")
|
||||
// Default in v3.6. Meaningful v2 state is not allowed.
|
||||
// The V2 files are maintained for v3.5 rollback.
|
||||
|
@ -28,7 +28,7 @@ const (
|
|||
// ability to rollback to etcd v3.5.
|
||||
V2_DEPR_2_GONE = V2DeprecationEnum("gone")
|
||||
|
||||
V2_DEPR_DEFAULT = V2_DEPR_0_NOT_YET
|
||||
V2_DEPR_DEFAULT = V2_DEPR_1_WRITE_ONLY
|
||||
)
|
||||
|
||||
func (e V2DeprecationEnum) IsAtLeast(v2d V2DeprecationEnum) bool {
|
||||
|
|
|
@ -122,7 +122,6 @@ func newConfig() *config {
|
|||
proxyFlagOn,
|
||||
),
|
||||
v2deprecation: flags.NewSelectiveStringsValue(
|
||||
string(cconfig.V2_DEPR_0_NOT_YET),
|
||||
string(cconfig.V2_DEPR_1_WRITE_ONLY),
|
||||
string(cconfig.V2_DEPR_1_WRITE_ONLY_DROP),
|
||||
string(cconfig.V2_DEPR_2_GONE)),
|
||||
|
|
|
@ -44,18 +44,6 @@ func createV2store(t testing.TB, lastReleaseBinary string, dataDirPath string) {
|
|||
}
|
||||
}
|
||||
|
||||
func assertVerifyCanStartV2deprecationNotYet(t testing.TB, dataDirPath string) {
|
||||
t.Log("verify: possible to start etcd with --v2-deprecation=not-yet mode")
|
||||
|
||||
cfg := e2e.ConfigStandalone(e2e.EtcdProcessClusterConfig{DataDirPath: dataDirPath, V2deprecation: "not-yet", KeepDataDir: true})
|
||||
epc, err := e2e.NewEtcdProcessCluster(t, cfg)
|
||||
assert.NoError(t, err)
|
||||
|
||||
defer func() {
|
||||
assert.NoError(t, epc.Stop())
|
||||
}()
|
||||
}
|
||||
|
||||
func assertVerifyCannotStartV2deprecationWriteOnly(t testing.TB, dataDirPath string) {
|
||||
t.Log("Verify its infeasible to start etcd with --v2-deprecation=write-only mode")
|
||||
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
|
|||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func assertVerifyCannotStartV2deprecationNotYet(t testing.TB, dataDirPath string) {
|
||||
t.Log("Verify its infeasible to start etcd with --v2-deprecation=not-yet mode")
|
||||
proc, err := e2e.SpawnCmd([]string{e2e.BinDir + "/etcd", "--v2-deprecation=not-yet", "--data-dir=" + dataDirPath}, nil)
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = proc.Expect(`invalid value "not-yet" for flag -v2-deprecation: invalid value "not-yet"`)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestV2Deprecation(t *testing.T) {
|
||||
e2e.BeforeTest(t)
|
||||
dataDirPath := t.TempDir()
|
||||
|
@ -78,12 +75,12 @@ func TestV2Deprecation(t *testing.T) {
|
|||
createV2store(t, lastReleaseBinary, dataDirPath)
|
||||
})
|
||||
|
||||
t.Run("--v2-deprecation=not-yet fails", func(t *testing.T) {
|
||||
assertVerifyCannotStartV2deprecationNotYet(t, dataDirPath)
|
||||
})
|
||||
|
||||
t.Run("--v2-deprecation=write-only fails", func(t *testing.T) {
|
||||
assertVerifyCannotStartV2deprecationWriteOnly(t, dataDirPath)
|
||||
})
|
||||
|
||||
t.Run("--v2-deprecation=not-yet succeeds", func(t *testing.T) {
|
||||
assertVerifyCanStartV2deprecationNotYet(t, dataDirPath)
|
||||
})
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue