-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathpulp_test.py
More file actions
81 lines (56 loc) · 2.49 KB
/
pulp_test.py
File metadata and controls
81 lines (56 loc) · 2.49 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import json
import pytest
PULP_HOST = 'localhost'
PULP_API_PORT = 24817
PULP_CONTENT_PORT = 24816
@pytest.fixture(scope="module")
def pulp_status_curl(server):
return server.run(f"curl -k -s -w '%{{stderr}}%{{http_code}}' http://{PULP_HOST}:{PULP_API_PORT}/pulp/api/v3/status/")
@pytest.fixture(scope="module")
def pulp_status(pulp_status_curl):
return json.loads(pulp_status_curl.stdout)
def test_pulp_api_service(server):
pulp_api = server.service("pulp-api")
assert pulp_api.is_running
def test_pulp_content_service(server):
pulp_content = server.service("pulp-content")
assert pulp_content.is_running
def test_pulp_worker_services(server):
result = server.run("systemctl list-units --all --type=service --no-legend 'pulp-worker@*.service' | awk '{print $1}'")
worker_services = [s.strip() for s in result.stdout.split('\n') if s.strip()]
assert len(worker_services) > 0
for worker_service in worker_services:
worker = server.service(worker_service)
assert worker.is_running
def test_pulp_api_port(server):
pulp_api = server.addr(PULP_HOST)
assert pulp_api.port(PULP_API_PORT).is_reachable
def test_pulp_content_port(server):
pulp_content = server.addr(PULP_HOST)
assert pulp_content.port(PULP_CONTENT_PORT).is_reachable
def test_pulp_status(pulp_status_curl):
assert pulp_status_curl.succeeded
assert pulp_status_curl.stderr == '200'
def test_pulp_status_database_connection(pulp_status):
assert pulp_status['database_connection']['connected']
def test_pulp_status_redis_connection(pulp_status):
assert pulp_status['redis_connection']['connected']
def test_pulp_status_api(pulp_status):
assert pulp_status['online_api_apps']
def test_pulp_status_content(pulp_status):
assert pulp_status['online_content_apps']
def test_pulp_status_workers(pulp_status):
assert pulp_status['online_workers']
def test_pulp_volumes(server):
assert server.file("/var/lib/pulp").is_directory
def test_pulp_worker_target(server):
pulp_worker_target = server.service("pulp-worker.target")
assert pulp_worker_target.is_running
assert pulp_worker_target.is_enabled
def test_pulp_manager_check(server):
result = server.run("podman exec -ti pulp-api pulpcore-manager check --deploy")
assert result.succeeded
def test_pulp_default_import_directory(server):
assert server.file("/var/lib/pulp/imports").is_directory
def test_pulp_default_export_directory(server):
assert server.file("/var/lib/pulp/exports").is_directory