@@ -89,36 +89,36 @@ Describe "[$global:IMAGE_NAME] image has jenkins-agent.ps1 in the correct locati
8989
9090Describe " [$global :IMAGE_NAME ] image starts jenkins-agent.ps1 correctly (slow test)" {
9191 It ' connects to the nmap container' {
92- $exitCode , $stdout , $stderr = Run- Program ' docker' ' network create --driver nat jnlp-network '
92+ $exitCode , $stdout , $stderr = Run- Program ' docker' " network create --driver nat $ global :JNLPNETWORKNAME "
9393 # Launch the netcat utility, listening at port 5000 for 30 sec
9494 # bats will capture the output from netcat and compare the first line
9595 # of the header of the first HTTP request with the expected one
96- $exitCode , $stdout , $stderr = Run- Program ' docker' ' run --detach --tty --name nmap --network=jnlp-network nmap:latest ncat.exe -w 30 -l 5000'
96+ $exitCode , $stdout , $stderr = Run- Program ' docker' " run --detach --tty --name $ global :NMAPCONTAINERNAME --network=$ global :JNLPNETWORKNAME nmap:latest ncat.exe -w 30 -l 5000"
9797 $exitCode | Should - Be 0
98- Is- ContainerRunning " nmap " | Should - BeTrue
98+ Is- ContainerRunning $ global :NMAPCONTAINERNAME | Should - BeTrue
9999
100100 # get the ip address of the nmap container
101- $exitCode , $stdout , $stderr = Run- Program ' docker' " inspect --format `" {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}`" nmap "
101+ $exitCode , $stdout , $stderr = Run- Program ' docker' " inspect --format `" {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}`" $ global :NMAPCONTAINERNAME "
102102 $exitCode | Should - Be 0
103103 $nmap_ip = $stdout.Trim ()
104104
105105 # run Jenkins agent which tries to connect to the nmap container at port 5000
106106 $secret = " aaa"
107107 $name = " bbb"
108- $exitCode , $stdout , $stderr = Run- Program ' docker' " run --detach --tty --network=jnlp-network --name $global :CONTAINERNAME $global :IMAGE_NAME -Url http://${nmap_ip} :5000 $secret $name "
108+ $exitCode , $stdout , $stderr = Run- Program ' docker' " run --detach --tty --network=$ global :JNLPNETWORKNAME --name $global :CONTAINERNAME $global :IMAGE_NAME -Url http://${nmap_ip} :5000 $secret $name "
109109 $exitCode | Should - Be 0
110110 Is- ContainerRunning $global :CONTAINERNAME | Should - BeTrue
111111
112- $exitCode , $stdout , $stderr = Run- Program ' docker' ' wait nmap '
113- $exitCode , $stdout , $stderr = Run- Program ' docker' ' logs nmap '
112+ $exitCode , $stdout , $stderr = Run- Program ' docker' " wait $ global :NMAPCONTAINERNAME "
113+ $exitCode , $stdout , $stderr = Run- Program ' docker' " logs $ global :NMAPCONTAINERNAME "
114114 $exitCode | Should - Be 0
115115 $stdout | Should -Match " GET /tcpSlaveAgentListener/ HTTP/1.1`r "
116116 }
117117
118118 AfterAll {
119119 Cleanup($global :CONTAINERNAME )
120- Cleanup(' nmap ' )
121- CleanupNetwork(' jnlp-network ' )
120+ Cleanup($ global :NMAPCONTAINERNAME )
121+ CleanupNetwork($ global :JNLPNETWORKNAME )
122122 }
123123}
124124
0 commit comments