-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_validation.py
46 lines (40 loc) · 1.23 KB
/
test_validation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from validation import (
CONTAINERFILE_TMPL,
RunValidations,
os,
)
TEST_ARGS = {
'user': 'stack',
'uid': 1000,
'keyfile': '/home/stack/.ssh/id_rsa',
'image': 'fedora:30',
'extra_pkgs': '',
'debug': False,
'validations': 'no-op',
'repository': 'https://opendev.org/openstack/tripleo-validations',
'branch': 'master',
'container': 'podman',
'inventory': '/home/stack/inventory.yaml',
'volumes': '',
'build': False,
'run': False,
'list': False,
'inventory_ping': False,
'group': '',
}
def test_containerfile_has_from_instruction():
assert 'FROM' in CONTAINERFILE_TMPL
def test_volume_is_created_for_local_repo(mocker):
os.path.isdir = mocker.MagicMock(return_value=True)
args = dict(TEST_ARGS)
args.update({
'repository': '/home/stack/tripleo-validations'
})
rv = RunValidations(args)
cmd = rv._RunValidations__build_start_cmd()
# Make sure VALIDATION_REPOSITORY env var is not set
assert ('--env=VALIDATION_REPOSITORY='
'/home/stack/tripleo-validations') not in cmd
# Make sure local repo is added as a volume
assert ('-v/home/stack/tripleo-validations:'
'/root/validation-repository:z') in cmd