Skip to content

Commit d726a9b

Browse files
authored
Merge pull request #5978 from thaJeztah/cli_command_update_TestNewDockerCliAndOperators
cli/command: TestNewDockerCliAndOperators: update test without DCT
2 parents 1c54b0b + 8f9fec1 commit d726a9b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

cli/command/cli_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,28 +298,27 @@ func TestExperimentalCLI(t *testing.T) {
298298

299299
func TestNewDockerCliAndOperators(t *testing.T) {
300300
// Test default operations and also overriding default ones
301-
cli, err := NewDockerCli(
302-
WithContentTrust(true),
303-
)
301+
cli, err := NewDockerCli(WithInputStream(io.NopCloser(strings.NewReader("some input"))))
304302
assert.NilError(t, err)
305303
// Check streams are initialized
306304
assert.Check(t, cli.In() != nil)
307305
assert.Check(t, cli.Out() != nil)
308306
assert.Check(t, cli.Err() != nil)
309-
assert.Equal(t, cli.ContentTrustEnabled(), true)
307+
inputStream, err := io.ReadAll(cli.In())
308+
assert.NilError(t, err)
309+
assert.Equal(t, string(inputStream), "some input")
310310

311311
// Apply can modify a dockerCli after construction
312-
inbuf := bytes.NewBuffer([]byte("input"))
313312
outbuf := bytes.NewBuffer(nil)
314313
errbuf := bytes.NewBuffer(nil)
315314
err = cli.Apply(
316-
WithInputStream(io.NopCloser(inbuf)),
315+
WithInputStream(io.NopCloser(strings.NewReader("input"))),
317316
WithOutputStream(outbuf),
318317
WithErrorStream(errbuf),
319318
)
320319
assert.NilError(t, err)
321320
// Check input stream
322-
inputStream, err := io.ReadAll(cli.In())
321+
inputStream, err = io.ReadAll(cli.In())
323322
assert.NilError(t, err)
324323
assert.Equal(t, string(inputStream), "input")
325324
// Check output stream

0 commit comments

Comments
 (0)