@@ -143,23 +143,6 @@ def create_dir():
143
143
except :
144
144
os .makedirs (outdir )
145
145
146
- # Take a screenshot using the webdriver
147
- def take_screenshot (endpoint ,container_tag ):
148
- print ('Taking screenshot of ' + container_tag + ' at ' + endpoint )
149
- try :
150
- requests .get (endpoint , timeout = 3 )
151
- driver .get (endpoint )
152
- driver .get_screenshot_as_file (outdir + container_tag + '.png' )
153
- report_tests .append (['Screenshot ' + container_tag ,'PASS' ])
154
- except (requests .Timeout , requests .ConnectionError , KeyError ) as e :
155
- report_tests .append (['Screenshot ' + container_tag ,'FAIL CONNECTION ERROR' ])
156
- except ErrorInResponseException as error :
157
- report_tests .append (['Screenshot ' + container_tag ,'FAIL SERVER ERROR' ])
158
- except TimeoutException as error :
159
- report_tests .append (['Screenshot ' + container_tag ,'FAIL TIMEOUT' ])
160
- except WebDriverException as error :
161
- report_tests .append (['Screenshot ' + container_tag ,'FAIL UNKNOWN' ])
162
-
163
146
# Main container test logic
164
147
def container_test (tag ):
165
148
# Start the container
@@ -187,17 +170,6 @@ def container_test(tag):
187
170
print ('Startup failed for ' + tag )
188
171
report_tests .append (['Startup ' + tag ,'FAIL INIT NOT FINISHED' ])
189
172
mark_fail ()
190
- if screenshot == 'true' :
191
- # Sleep for the user specified amount of time
192
- time .sleep (int (testdelay ))
193
- # Take a screenshot
194
- if ssl == 'true' :
195
- proto = 'https://'
196
- else :
197
- proto = 'http://'
198
- container .reload ()
199
- ip = container .attrs ["NetworkSettings" ]["Networks" ]["bridge" ]["IPAddress" ]
200
- take_screenshot (proto + webauth + '@' + ip + ':' + port + webpath ,tag )
201
173
# Dump package information
202
174
print ('Dumping package info for ' + tag )
203
175
if base == 'alpine' :
@@ -213,6 +185,32 @@ def container_test(tag):
213
185
print (error )
214
186
report_tests .append (['Dump Versions ' + tag ,'FAIL' ])
215
187
mark_fail ()
188
+ # Screenshot web interface and check connectivity
189
+ if screenshot == 'true' :
190
+ # Sleep for the user specified amount of time
191
+ time .sleep (int (testdelay ))
192
+ # Take a screenshot
193
+ if ssl == 'true' :
194
+ proto = 'https://'
195
+ else :
196
+ proto = 'http://'
197
+ container .reload ()
198
+ ip = container .attrs ["NetworkSettings" ]["Networks" ]["bridge" ]["IPAddress" ]
199
+ endpoint = proto + webauth + '@' + ip + ':' + port + webpath
200
+ print ('Taking screenshot of ' + tag + ' at ' + endpoint )
201
+ try :
202
+ requests .get (endpoint , timeout = 3 )
203
+ driver .get (endpoint )
204
+ driver .get_screenshot_as_file (outdir + tag + '.png' )
205
+ report_tests .append (['Screenshot ' + tag ,'PASS' ])
206
+ except (requests .Timeout , requests .ConnectionError , KeyError ) as e :
207
+ report_tests .append (['Screenshot ' + tag ,'FAIL CONNECTION ERROR' ])
208
+ except ErrorInResponseException as error :
209
+ report_tests .append (['Screenshot ' + tag ,'FAIL SERVER ERROR' ])
210
+ except TimeoutException as error :
211
+ report_tests .append (['Screenshot ' + tag ,'FAIL TIMEOUT' ])
212
+ except WebDriverException as error :
213
+ report_tests .append (['Screenshot ' + tag ,'FAIL UNKNOWN' ])
216
214
# Grab build version
217
215
try :
218
216
build_version = container .attrs ["Config" ]["Labels" ]["build_version" ]
@@ -221,6 +219,8 @@ def container_test(tag):
221
219
build_version = 'ERROR'
222
220
report_tests .append (['Get Build Version ' + tag ,'FAIL' ])
223
221
mark_fail ()
222
+ # Grab container logs for last time before destruction
223
+ logblob = container .logs ().decode ("utf-8" )
224
224
# Add the info to the report
225
225
report_containers .append ({
226
226
"tag" :tag ,
0 commit comments