Skip to content

Commit e47a5c7

Browse files
committed
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>
1 parent 63158f7 commit e47a5c7

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

cli/command/container/run_test.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import (
1616
"github.com/moby/moby/api/types"
1717
"github.com/moby/moby/api/types/container"
1818
"github.com/moby/moby/client"
19-
"github.com/moby/moby/client/pkg/progress"
20-
"github.com/moby/moby/client/pkg/streamformatter"
2119
"github.com/spf13/pflag"
2220
"gotest.tools/v3/assert"
2321
is "gotest.tools/v3/assert/cmp"
@@ -245,20 +243,12 @@ func TestRunPullTermination(t *testing.T) {
245243
_ = server.Close()
246244
})
247245
go func() {
248-
id := test.RandomID()[:12] // short-ID
249-
progressOutput := streamformatter.NewJSONProgressOutput(server, true)
250-
for i := range 100 {
246+
for range 100 {
251247
select {
252248
case <-ctx.Done():
253249
assert.NilError(t, server.Close(), "failed to close imageCreateFunc server")
254250
return
255251
default:
256-
assert.NilError(t, progressOutput.WriteProgress(progress.Progress{
257-
ID: id,
258-
Message: "Downloading",
259-
Current: int64(i),
260-
Total: 100,
261-
}))
262252
time.Sleep(100 * time.Millisecond)
263253
}
264254
}

internal/jsonstream/display_test.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import (
77
"time"
88

99
"github.com/docker/cli/cli/streams"
10-
"github.com/docker/cli/internal/test"
11-
"github.com/moby/moby/client/pkg/progress"
12-
"github.com/moby/moby/client/pkg/streamformatter"
1310
"gotest.tools/v3/assert"
1411
)
1512

@@ -23,23 +20,12 @@ func TestDisplay(t *testing.T) {
2320
})
2421

2522
go func() {
26-
id := test.RandomID()[:12] // short-ID
27-
progressOutput := streamformatter.NewJSONProgressOutput(server, true)
28-
for i := range 100 {
23+
for range 100 {
2924
select {
3025
case <-ctx.Done():
3126
assert.NilError(t, server.Close(), "failed to close jsonmessage server")
3227
return
3328
default:
34-
err := progressOutput.WriteProgress(progress.Progress{
35-
ID: id,
36-
Message: "Downloading",
37-
Current: int64(i),
38-
Total: 100,
39-
})
40-
if err != nil {
41-
break
42-
}
4329
time.Sleep(100 * time.Millisecond)
4430
}
4531
}
@@ -50,8 +36,7 @@ func TestDisplay(t *testing.T) {
5036

5137
done := make(chan error)
5238
go func() {
53-
out := streams.NewOut(io.Discard)
54-
done <- Display(streamCtx, client, out)
39+
done <- Display(streamCtx, client, streams.NewOut(io.Discard))
5540
}()
5641

5742
cancelStream()

0 commit comments

Comments
 (0)