-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update downgrade test to use a snapshot #16041
Conversation
lastVersion, err := e2e.GetVersionFromBinary(e2e.BinPath.EtcdLastRelease) | ||
lastVersionStr := lastVersion.String() | ||
lastClusterVersion := semver.New(lastVersionStr) | ||
lastClusterVersion.Patch = 0 | ||
lastClusterVersionStr := lastClusterVersion.String() | ||
t.Logf("etcdctl downgrade enable %s", lastVersionStr) | ||
downgradeEnable(t, epc, lastVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you refactor this code to separate function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updating.
@@ -182,6 +184,74 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) { | |||
assert.NoError(t, epc.Close()) | |||
} | |||
|
|||
func TestV2DeprecationSnapshotRecoverOldVersion(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a standard downgrade test. Have you seen the test in
etcd/tests/e2e/cluster_downgrade_test.go
Line 22 in a708bed
"testing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
etcd/tests/e2e/cluster_downgrade_test.go
Line 22 in a708bed
"testing" |
In next changes when we change how the .snap is published by 3.6, we need a test that recovers from .snap and verifies membership match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please let me know if I should add the test to cluster_downgrade_test.go instead of this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test does not seem to create a snapshot and kvs.
This is not unique to v2 store. Please just update existing downgrade tests with additional validation.
e0a0a65
to
41c47d7
Compare
tests/e2e/cluster_downgrade_test.go
Outdated
ctx, cancel := context.WithCancel(context.Background()) | ||
defer cancel() | ||
|
||
t.Log("Adding and removing keys") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I only see adding keys, and do not se removing keys:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I will update the comment.
tests/e2e/cluster_downgrade_test.go
Outdated
@@ -67,7 +69,7 @@ func testDowngradeUpgrade(t *testing.T, clusterSize int) { | |||
e2e.BeforeTest(t) | |||
|
|||
t.Logf("Create cluster with version %s", currentVersionStr) | |||
epc := newCluster(t, clusterSize) | |||
epc := newCluster(t, clusterSize, 10, t.TempDir()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dataDirPath is t.TempDir by default, FYI.
etcd/tests/framework/e2e/cluster.go
Line 504 in 61736c3
dataDirPath = tb.TempDir() |
epc := newCluster(t, clusterSize, 10, t.TempDir()) | |
epc := newCluster(t, clusterSize, 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also the hard coded value 10 is used multiple times, can you define a constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updating.
tests/e2e/cluster_downgrade_test.go
Outdated
@@ -76,6 +78,8 @@ func testDowngradeUpgrade(t *testing.T, clusterSize int) { | |||
}) | |||
} | |||
t.Logf("Cluster created") | |||
generateSnapshot(t, 10, epc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, it might be useful to have both downgrade tests with and without snapshot.
TestDowngradeUpgradeClusterOf1
and TestDowngradeUpgradeClusterOf1WithSnapshot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sg. updating.
tests/e2e/cluster_downgrade_test.go
Outdated
@@ -76,6 +78,8 @@ func testDowngradeUpgrade(t *testing.T, clusterSize int) { | |||
}) | |||
} | |||
t.Logf("Cluster created") | |||
generateSnapshot(t, 10, epc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use names const variables instead of magical numbers 10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updating.
99bb785
to
ff8a08c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @geetasg
for i = 0; i < snapshotCount*3; i++ { | ||
err := cc.Put(ctx, fmt.Sprintf("%d", i), "1", config.PutOptions{}) | ||
assert.NoError(t, err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followup @geetasg. Could this function confirm that there is a snapshot file on disk present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Signed-off-by: Geeta Gharpure <geetagh@amazon.com>
Thanks @geetasg for sharing the doc v2deprecation-3.6 !! For context to anyone else that has interest in this PR, the added test case is to ensure the following attempt won't regress..
|
Related to task - "V2 snapshots are generated from V3 data" - #12913
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.