mirror of
https://github.com/docker/cli.git
synced 2026-08-24 02:24:17 -05:00
remove redundant uses of streamformatter in tests
The output of this was not used in the tests, and shouldn't be needed as part of it. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -16,8 +16,6 @@ import (
|
||||
"github.com/moby/moby/api/types"
|
||||
"github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/moby/moby/client/pkg/progress"
|
||||
"github.com/moby/moby/client/pkg/streamformatter"
|
||||
"github.com/spf13/pflag"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
@@ -245,20 +243,12 @@ func TestRunPullTermination(t *testing.T) {
|
||||
_ = server.Close()
|
||||
})
|
||||
go func() {
|
||||
id := test.RandomID()[:12] // short-ID
|
||||
progressOutput := streamformatter.NewJSONProgressOutput(server, true)
|
||||
for i := range 100 {
|
||||
for range 100 {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
assert.NilError(t, server.Close(), "failed to close imageCreateFunc server")
|
||||
return
|
||||
default:
|
||||
assert.NilError(t, progressOutput.WriteProgress(progress.Progress{
|
||||
ID: id,
|
||||
Message: "Downloading",
|
||||
Current: int64(i),
|
||||
Total: 100,
|
||||
}))
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/cli/cli/streams"
|
||||
"github.com/docker/cli/internal/test"
|
||||
"github.com/moby/moby/client/pkg/progress"
|
||||
"github.com/moby/moby/client/pkg/streamformatter"
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
@@ -23,23 +20,12 @@ func TestDisplay(t *testing.T) {
|
||||
})
|
||||
|
||||
go func() {
|
||||
id := test.RandomID()[:12] // short-ID
|
||||
progressOutput := streamformatter.NewJSONProgressOutput(server, true)
|
||||
for i := range 100 {
|
||||
for range 100 {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
assert.NilError(t, server.Close(), "failed to close jsonmessage server")
|
||||
return
|
||||
default:
|
||||
err := progressOutput.WriteProgress(progress.Progress{
|
||||
ID: id,
|
||||
Message: "Downloading",
|
||||
Current: int64(i),
|
||||
Total: 100,
|
||||
})
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
@@ -50,8 +36,7 @@ func TestDisplay(t *testing.T) {
|
||||
|
||||
done := make(chan error)
|
||||
go func() {
|
||||
out := streams.NewOut(io.Discard)
|
||||
done <- Display(streamCtx, client, out)
|
||||
done <- Display(streamCtx, client, streams.NewOut(io.Discard))
|
||||
}()
|
||||
|
||||
cancelStream()
|
||||
|
||||
Reference in New Issue
Block a user