|
2 | 2 | import subprocess
|
3 | 3 | import hashlib
|
4 | 4 |
|
| 5 | +from lib import commands |
| 6 | + |
5 | 7 | # This test is designed to verify the accessibility of the XOA deployment script
|
6 | 8 | #
|
7 | 9 | # Requirements:
|
|
10 | 12 | @pytest.mark.parametrize("command_id", ["curl", "wget"])
|
11 | 13 | @pytest.mark.parametrize("url_id", [
|
12 | 14 | "xoa",
|
13 |
| - "xcp-ng", |
| 15 | + "xcpng", |
14 | 16 | "vates"
|
15 | 17 | ])
|
16 | 18 | def test_access_links(host, command_id, url_id):
|
17 | 19 | """
|
18 | 20 | Verifies that the specified URL responds correctly via the specified command
|
19 | 21 | and compares the checksum of the downloaded content between local and remote.
|
20 | 22 | """
|
21 |
| - command = {"curl": "curl -fsSL", |
22 |
| - "wget": "wget -qO-"}[command_id] |
| 23 | + command = {"curl": ["curl", "-fsSL"], |
| 24 | + "wget": ["wget", "-qO-"]}[command_id] |
23 | 25 | url = {
|
24 | 26 | "xoa": "https://xoa.io/deploy",
|
25 | 27 | "xcpng": "https://updates.xcp-ng.org/trace",
|
26 | 28 | "vates": "https://repo.vates.tech/README.txt"
|
27 | 29 | }[url_id]
|
28 |
| - COMMAND = f"{command} '{url}'" |
| 30 | + COMMAND = command + [url] |
29 | 31 |
|
30 | 32 | # Download from remote host
|
31 | 33 | remote_result = host.ssh(COMMAND)
|
32 | 34 |
|
33 | 35 | # Verify the download worked by comparing with local download
|
34 | 36 | # This ensures the content is accessible and identical from both locations
|
35 |
| - local_result = host.local_cmd(COMMAND) |
| 37 | + local_result = commands.local_cmd(COMMAND) |
36 | 38 |
|
37 | 39 | assert local_result.returncode == 0, (
|
38 | 40 | f"Failed to fetch URL locally: {local_result.stderr}"
|
|
0 commit comments