mirror of
https://github.com/docker/compose.git
synced 2026-11-19 14:40:08 +00:00
test(e2e): migrate TestEventsUnknownService to a scenario
Express the intent (events refuses a service outside the project) with the Scenario DSL; the project now lives in testdata/TestEventsUnknownService. The shared fixtures/simple-composefile is still used by another test. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
783cd10211
commit
813238a7c7
2 changed files with 12 additions and 8 deletions
|
|
@ -21,15 +21,12 @@ package e2e
|
|||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
func TestEventsUnknownService(t *testing.T) {
|
||||
c := NewParallelCLI(t)
|
||||
|
||||
cmd := c.NewDockerComposeCmd(t, "-f", "./fixtures/simple-composefile/compose.yaml", "events", "not-a-service")
|
||||
cmd.Timeout = 10 * time.Second
|
||||
res := icmd.RunCmd(cmd)
|
||||
res.Assert(t, icmd.Expected{ExitCode: 1, Err: "no such service: not-a-service"})
|
||||
NewScenario(t, "events must refuse a service that is not in the project").
|
||||
Step("events on an unknown service fails and names it",
|
||||
ComposeCmd("events", "not-a-service").MayFail().Within(10*time.Second),
|
||||
ExitCode(1),
|
||||
StderrContains("no such service: not-a-service"))
|
||||
}
|
||||
|
|
|
|||
7
pkg/e2e/testdata/TestEventsUnknownService/compose.yaml
vendored
Normal file
7
pkg/e2e/testdata/TestEventsUnknownService/compose.yaml
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
services:
|
||||
simple:
|
||||
image: alpine
|
||||
command: top
|
||||
another:
|
||||
image: alpine
|
||||
command: top
|
||||
Loading…
Add table
Add a link
Reference in a new issue