ci: fix docker logger not supported test

This test checks for behavior when asking for logs of a docker task
configured with a log driver that does not support streaming logs.

Previously this was using the 'gelf' log driver, but it seems that no
longer returns an error as expected. Instead we can just use the 'none'
log driver, which has the desired effect

2022-04-19T10:23:19.129-0500 [ERROR] docklog/docker_logger.go:133: log streaming ended with terminal error: error="API error (501): configured logging driver does not support reading"
This commit is contained in:
Seth Hoenig
2022-04-19 10:24:35 -05:00
parent 3e394fce69
commit cbb09f31a5

View File

@@ -216,8 +216,6 @@ func TestDockerLogger_LoggingNotSupported(t *testing.T) {
ci.Parallel(t)
ctu.DockerCompatible(t)
require := require.New(t)
containerImage, containerImageName, containerImageTag := testContainerDetails()
client, err := docker.NewClientFromEnv()
@@ -231,7 +229,7 @@ func TestDockerLogger_LoggingNotSupported(t *testing.T) {
Repository: containerImageName,
Tag: containerImageTag,
}, docker.AuthConfiguration{})
require.NoError(err, "failed to pull image")
require.NoError(t, err, "failed to pull image")
}
containerConf := docker.CreateContainerOptions{
@@ -243,19 +241,15 @@ func TestDockerLogger_LoggingNotSupported(t *testing.T) {
},
HostConfig: &docker.HostConfig{
LogConfig: docker.LogConfig{
Type: "gelf",
Config: map[string]string{
"gelf-address": "udp://localhost:12201",
"mode": "non-blocking",
"max-buffer-size": "4m",
},
Type: "none",
Config: map[string]string{},
},
},
Context: context.Background(),
}
container, err := client.CreateContainer(containerConf)
require.NoError(err)
require.NoError(t, err)
defer client.RemoveContainer(docker.RemoveContainerOptions{
ID: container.ID,
@@ -263,7 +257,7 @@ func TestDockerLogger_LoggingNotSupported(t *testing.T) {
})
err = client.StartContainer(container.ID, nil)
require.NoError(err)
require.NoError(t, err)
testutil.WaitForResult(func() (bool, error) {
container, err = client.InspectContainer(container.ID)
@@ -275,7 +269,7 @@ func TestDockerLogger_LoggingNotSupported(t *testing.T) {
}
return true, nil
}, func(err error) {
require.NoError(err)
require.NoError(t, err)
})
stdout := &noopCloser{bytes.NewBuffer(nil)}
@@ -284,14 +278,14 @@ func TestDockerLogger_LoggingNotSupported(t *testing.T) {
dl := NewDockerLogger(testlog.HCLogger(t)).(*dockerLogger)
dl.stdout = stdout
dl.stderr = stderr
require.NoError(dl.Start(&StartOpts{
require.NoError(t, dl.Start(&StartOpts{
ContainerID: container.ID,
}))
select {
case <-dl.doneCh:
case <-time.After(10 * time.Second):
require.Fail("timedout while waiting for docker_logging to terminate")
require.Fail(t, "timeout while waiting for docker_logging to terminate")
}
}