From a1f3c2c7cc795ec0da31e364a258ccc98a7ccc44 Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Mon, 17 Jan 2022 15:03:17 +0100 Subject: [PATCH] server: Make --v2-deprecation=write-only the default and remove not-yet option --- server/config/v2_deprecation.go | 4 ++-- server/etcdmain/config.go | 1 - tests/e2e/v2store_deprecation_test.go | 29 ++++++++++++--------------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/server/config/v2_deprecation.go b/server/config/v2_deprecation.go index 828bd9a8f43..862c3bb9343 100644 --- a/server/config/v2_deprecation.go +++ b/server/config/v2_deprecation.go @@ -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 { diff --git a/server/etcdmain/config.go b/server/etcdmain/config.go index 4257f1ba081..39ae8def3fd 100644 --- a/server/etcdmain/config.go +++ b/server/etcdmain/config.go @@ -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)), diff --git a/tests/e2e/v2store_deprecation_test.go b/tests/e2e/v2store_deprecation_test.go index 98442d842d9..a8afde5aaa9 100644 --- a/tests/e2e/v2store_deprecation_test.go +++ b/tests/e2e/v2store_deprecation_test.go @@ -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=write-only fails", func(t *testing.T) { - assertVerifyCannotStartV2deprecationWriteOnly(t, dataDirPath) + t.Run("--v2-deprecation=not-yet fails", func(t *testing.T) { + assertVerifyCannotStartV2deprecationNotYet(t, dataDirPath) }) - t.Run("--v2-deprecation=not-yet succeeds", func(t *testing.T) { - assertVerifyCanStartV2deprecationNotYet(t, dataDirPath) + t.Run("--v2-deprecation=write-only fails", func(t *testing.T) { + assertVerifyCannotStartV2deprecationWriteOnly(t, dataDirPath) }) }