forked from osism/ansible-collection-commons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkompose.py
51 lines (39 loc) · 1.55 KB
/
kompose.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
47
48
49
50
51
from .util.util import get_ansible, get_variable
testinfra_runner, testinfra_hosts = get_ansible()
def test_kompose_not_installed(host):
package_name = "kompose"
package = host.package(package_name)
assert not package.is_installed
def test_kompose_preferences_file(host):
f = host.file("/etc/apt/preferences.d/kompose")
assert f.exists
assert f.user == "root"
assert f.group == "root"
assert f.mode == 0o644
assert "Pin-Priority: -1" in f.content_string
def test_kompose_binary_exists(host):
kompose_path = "/usr/local/bin/kompose"
f = host.file(kompose_path)
assert f.exists
assert f.user == "root"
assert f.group == "root"
assert f.mode == 0o755
def test_kompose_binary_checksum(host):
ansible_arch = get_variable(host, "ansible_architecture", True)
kompose_checksums = get_variable(host, "kompose_checksums")
kompose_path = "/usr/local/bin/kompose"
if ansible_arch == "x86_64":
kompose_checksum = kompose_checksums.get("amd64")
f = host.file(kompose_path)
assert f.exists
assert f.sha256sum == kompose_checksum
if ansible_arch == "aarch64" or ansible_arch == "arm64":
kompose_checksum = kompose_checksums.get("arm64")
f = host.file(kompose_path)
assert f.exists
assert f.sha256sum == kompose_checksum
if ansible_arch == "armv6l" or ansible_arch == "armv7l":
kompose_checksum = kompose_checksums.get("arm")
f = host.file(kompose_path)
assert f.exists
assert f.sha256sum == kompose_checksum