blob: 4338c8a83d84237b0eff7ffdb7153a3a60094715 [file] [log] [blame]
Bartek Grzybowskidd6d4d52022-03-04 16:35:02 +01001import pytest # pylint: disable=W0611
2from docker import from_env # pylint: disable=W0611
3
4# Library routines
5
6def parse_check_output(mode, test_image_list, output):
7 '''mode - True|False'''
8 # for each test image check if it's marked as "True or False" (depending on mode) in fixture output
9 for image in test_image_list:
10 found = 0
11 for line in output.split('\n'):
12 if (image in line) and (mode in line):
13 found = 1
14 break
15 if not found:
16 print('ERROR: Image {} was not reported by "--check" option as {}'.format(image,mode))
17 assert 0
18 assert 1
19
20# Actual test routines
21
22def test_check_mode_images_not_pulled(drop_test_images, init_cli_check, test_image_list): # pylint: disable=W0613
23 parse_check_output("False", test_image_list, init_cli_check)
24
25def test_pull_images_from_mirror(init_cli_with_registry_mirror, test_image_list, init_cli_check): # pylint: disable=W0613
26 parse_check_output("True", test_image_list, init_cli_check)
27
28def test_pull_images(drop_test_images, init_cli, test_image_list, init_cli_check): # pylint: disable=W0613
29 parse_check_output("True", test_image_list, init_cli_check)
30
31def test_cleanup_images(drop_test_images): # pylint: disable=W0613
32 # Noop routine to cleanup test images
33 assert 1