Merge pull request #16692 from serathius/getformat

Avoid timing out and provide a proper error in TestCtlV3GetFormat test
This commit is contained in:
Marek Siarkowicz 2023-10-05 12:49:30 +02:00 committed by GitHub
commit 24b679644d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,9 +17,11 @@ package e2e
import ( import (
"context" "context"
"fmt" "fmt"
"strings"
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.etcd.io/etcd/pkg/v3/expect" "go.etcd.io/etcd/pkg/v3/expect"
@ -179,9 +181,11 @@ func getFormatTest(cx ctlCtx) {
cmdArgs = append(cmdArgs, "--print-value-only") cmdArgs = append(cmdArgs, "--print-value-only")
} }
cmdArgs = append(cmdArgs, "abc") cmdArgs = append(cmdArgs, "abc")
if err := e2e.SpawnWithExpectWithEnv(cmdArgs, cx.envMap, expect.ExpectedResponse{Value: tt.wstr}); err != nil { lines, err := e2e.RunUtilCompletion(cmdArgs, cx.envMap)
cx.t.Errorf("#%d: error (%v), wanted %v", i, err, tt.wstr) if err != nil {
cx.t.Errorf("#%d: error (%v)", i, err)
} }
assert.Contains(cx.t, strings.Join(lines, "\n"), tt.wstr)
} }
} }