From f26ff912a98d08d8c9ac94563a99051c75c4a493 Mon Sep 17 00:00:00 2001 From: Thomas Gosteli Date: Wed, 6 Nov 2024 14:15:07 +0100 Subject: [PATCH] chore(e2e): adapt defrag tests for 3.5 Signed-off-by: Thomas Gosteli --- tests/e2e/defrag_no_space_test.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/e2e/defrag_no_space_test.go b/tests/e2e/defrag_no_space_test.go index f6ceabe667b..1f5c2b50894 100644 --- a/tests/e2e/defrag_no_space_test.go +++ b/tests/e2e/defrag_no_space_test.go @@ -22,7 +22,6 @@ import ( "github.com/stretchr/testify/require" - "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/e2e" ) @@ -48,21 +47,25 @@ func TestDefragNoSpace(t *testing.T) { t.Run(tc.name, func(t *testing.T) { e2e.BeforeTest(t) - clus, err := e2e.NewEtcdProcessCluster(context.TODO(), t, - e2e.WithClusterSize(1), - e2e.WithGoFailEnabled(true), + clus, err := e2e.NewEtcdProcessCluster(t, + &e2e.EtcdProcessClusterConfig{ + ClusterSize: 1, + LogLevel: "debug", + GoFailEnabled: true, + }, ) require.NoError(t, err) t.Cleanup(func() { clus.Stop() }) member := clus.Procs[0] + etcdctl := member.Etcdctl(e2e.ClientNonTLS, false, false) require.NoError(t, member.Failpoints().SetupHTTP(context.Background(), tc.failpoint, fmt.Sprintf(`return("%s")`, tc.err))) - require.ErrorContains(t, member.Etcdctl().Defragment(context.Background(), config.DefragOption{Timeout: time.Minute}), tc.err) + require.ErrorContains(t, etcdctl.Defragment(time.Minute), tc.err) // Make sure etcd continues to run even after the failed defrag attempt - require.NoError(t, member.Etcdctl().Put(context.Background(), "foo", "bar", config.PutOptions{})) - value, err := member.Etcdctl().Get(context.Background(), "foo", config.GetOptions{}) + require.NoError(t, etcdctl.Put("foo", "bar")) + value, err := etcdctl.Get("foo") require.NoError(t, err) require.Len(t, value.Kvs, 1) require.Equal(t, "bar", string(value.Kvs[0].Value))