Better debug info if test fail

Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
Guillaume Tardif 2021-02-12 09:45:00 +01:00
parent b4fa7b2fa3
commit ac5c422d77
2 changed files with 6 additions and 4 deletions

View File

@ -64,7 +64,9 @@ func TestDownRemoveOrphans(t *testing.T) {
ctx := context.Background()
api.EXPECT().ContainerList(ctx, projectFilterListOpt(testProject)).Return(
[]apitypes.Container{testContainer("service1", "123"), testContainer("service2", "789"), testContainer("service_orphan", "321")}, nil).Times(2)
[]apitypes.Container{testContainer("service1", "123"),
testContainer("service2", "789"),
testContainer("service_orphan", "321")}, nil).Times(2)
api.EXPECT().ContainerStop(ctx, "123", nil).Return(nil)
api.EXPECT().ContainerStop(ctx, "789", nil).Return(nil)

View File

@ -101,9 +101,9 @@ func TestLocalBackendRun(t *testing.T) {
fields := strings.Fields(line)
if fields[0] == nginxID {
nginxFound = true
assert.Equal(t, fields[1], "nginx")
assert.Equal(t, fields[2], "/docker-entrypoint.sh")
assert.Equal(t, fields[len(fields)-1], "0.0.0.0:85->80/tcp")
assert.Equal(t, fields[1], "nginx", res.Combined())
assert.Equal(t, fields[2], "/docker-entrypoint.sh", res.Combined())
assert.Equal(t, fields[len(fields)-1], "0.0.0.0:85->80/tcp", res.Combined())
}
}
assert.Assert(t, nginxFound, res.Stdout())