Skip to content

Commit

Permalink
chore(e2e): adapt defrag tests for 3.5
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Gosteli <[email protected]>
  • Loading branch information
ghouscht committed Nov 6, 2024
1 parent 1d17507 commit 733ff1f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tests/e2e/defrag_no_space_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -48,21 +47,26 @@ 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))
Expand Down

0 comments on commit 733ff1f

Please sign in to comment.