Don't set the container name in the test

This will help us catch errors such as
https://github.com/docker/desktop-microsoft/issues/42
This commit is contained in:
Djordje Lukic 2020-07-16 10:39:41 +02:00
parent a2edb5b64e
commit 4480d27595
1 changed files with 10 additions and 7 deletions
tests/aci-e2e

View File

@ -81,6 +81,7 @@ func (s *E2eACISuite) TestLoginLogoutCreateContextError() {
} }
func (s *E2eACISuite) TestACIRunSingleContainer() { func (s *E2eACISuite) TestACIRunSingleContainer() {
var containerName string
resourceGroupName := s.setupTestResourceGroup() resourceGroupName := s.setupTestResourceGroup()
defer deleteResourceGroup(resourceGroupName) defer deleteResourceGroup(resourceGroupName)
@ -105,8 +106,10 @@ func (s *E2eACISuite) TestACIRunSingleContainer() {
"-v", fmt.Sprintf("%s:%s@%s:%s", "-v", fmt.Sprintf("%s:%s@%s:%s",
testStorageAccountName, firstKey, testShareName, mountTarget), testStorageAccountName, firstKey, testShareName, mountTarget),
"-p", "80:80", "-p", "80:80",
"--name", testContainerName).ExecOrDie() ).ExecOrDie()
Expect(output).To(ContainSubstring(testContainerName)) runOutput := Lines(output)
containerName = runOutput[len(runOutput)-1]
output = s.NewDockerCommand("ps").ExecOrDie() output = s.NewDockerCommand("ps").ExecOrDie()
lines := Lines(output) lines := Lines(output)
Expect(len(lines)).To(Equal(2)) Expect(len(lines)).To(Equal(2))
@ -127,10 +130,10 @@ func (s *E2eACISuite) TestACIRunSingleContainer() {
}) })
s.Step("exec command", func() { s.Step("exec command", func() {
output := s.NewDockerCommand("exec", testContainerName, "pwd").ExecOrDie() output := s.NewDockerCommand("exec", containerName, "pwd").ExecOrDie()
Expect(output).To(ContainSubstring("/")) Expect(output).To(ContainSubstring("/"))
_, err := s.NewDockerCommand("exec", testContainerName, "echo", "fail_with_argument").Exec() _, err := s.NewDockerCommand("exec", containerName, "echo", "fail_with_argument").Exec()
Expect(err.Error()).To(ContainSubstring("ACI exec command does not accept arguments to the command. " + Expect(err.Error()).To(ContainSubstring("ACI exec command does not accept arguments to the command. " +
"Only the binary should be specified")) "Only the binary should be specified"))
}) })
@ -138,7 +141,7 @@ func (s *E2eACISuite) TestACIRunSingleContainer() {
s.Step("follow logs from nginx", func() { s.Step("follow logs from nginx", func() {
timeChan := make(chan time.Time) timeChan := make(chan time.Time)
ctx := s.NewDockerCommand("logs", "--follow", testContainerName).WithTimeout(timeChan) ctx := s.NewDockerCommand("logs", "--follow", containerName).WithTimeout(timeChan)
outChan := make(chan string) outChan := make(chan string)
go func() { go func() {
@ -163,8 +166,8 @@ func (s *E2eACISuite) TestACIRunSingleContainer() {
}) })
s.Step("removes container nginx", func() { s.Step("removes container nginx", func() {
output := s.NewDockerCommand("rm", testContainerName).ExecOrDie() output := s.NewDockerCommand("rm", containerName).ExecOrDie()
Expect(Lines(output)[0]).To(Equal(testContainerName)) Expect(Lines(output)[0]).To(Equal(containerName))
}) })
s.Step("re-run nginx with modified cpu/mem, and without --detach and follow logs", func() { s.Step("re-run nginx with modified cpu/mem, and without --detach and follow logs", func() {