Skip to content

Commit b5c1e7e

Browse files
committed
updated test mirror format
1 parent a19a6d3 commit b5c1e7e

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

stackinator/schema/mirror.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"description": {
1313
"type": "string",
1414
"description": "What this mirror is for."
15-
}
15+
},
1616
"enabled": {
1717
"type": "boolean",
1818
"default": true,
@@ -34,12 +34,12 @@
3434
},
3535
"private_key": {
3636
"type": "string",
37-
"description": "Private PGP key for signing binary cache packages. (Path only)",
37+
"description": "Private PGP key for signing binary cache packages. (Path only)"
3838
},
3939
"mount_specific": {
4040
"type": "boolean",
4141
"default": false,
42-
"description": "Use a mount specific buildcache path (specified path + recipe mount point).",
42+
"description": "Use a mount specific buildcache path (specified path + recipe mount point)."
4343
}
4444
}
4545
}
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
- name: fake-mirror
2-
url: https://google.com
3-
- name: disabled-mirror
4-
url: https://google.com
1+
- url: https://google.com
2+
- url: https://google.com
53
enabled: false
6-
- name: buildcache-mirror
7-
url: https://cache.spack.io/
8-
buildcache: true
9-
- name: bootstrap-mirror
10-
url: https://mirror.spack.io
4+
- url: https://cache.spack.io/
5+
cache: true
6+
- url: https://mirror.spack.io
117
bootstrap: true

unittests/test_mirrors.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,19 @@ def systems_path(test_path):
1414
@pytest.fixture
1515
def valid_mirrors(systems_path):
1616
mirrors = {}
17-
mirrors["fake-mirror"] = {'url': 'https://google.com'}
18-
mirrors["buildcache-mirror"] = {'url': 'https://cache.spack.io/', 'buildcache': True}
19-
mirrors["bootstrap-mirror"] = {'url': 'https://mirror.spack.io', 'bootstrap': True}
17+
mirrors["fake-mirror"] = {'url': 'https://google.com', 'enabled': True, 'bootstrap': False, 'cache': False, 'mount_specific': False}
18+
mirrors["buildcache-mirror"] = {'url': 'https://cache.spack.io/', 'enabled': True, 'bootstrap': False, 'cache': True, 'mount_specific': False}
19+
mirrors["bootstrap-mirror"] = {'url': 'https://mirror.spack.io', 'enabled': True, 'bootstrap': True, 'cache': False, 'mount_specific': False}
2020
return mirrors
2121

2222
def test_mirror_init(systems_path, valid_mirrors):
2323
path = systems_path / "mirror_ok"
24-
mirrors = mirror.Mirrors(path)
25-
print(valid_mirrors)
26-
print(mirrors)
27-
assert mirrors == valid_mirrors
28-
assert mirrors.bootstrap_mirrors == [mirror for mirror in valid_mirrors if mirror["bootstrap"]]
29-
assert mirrors.build_cache_mirror == [mirror for mirror in valid_mirrors if mirror['buildcache']]
24+
mirrors_obj = mirror.Mirrors(path)
25+
assert mirrors_obj.mirrors == valid_mirrors
26+
assert mirrors_obj.mirrors.bootstrap_mirrors == [mirror for mirror in valid_mirrors.values() if mirror.get('bootstrap')]
27+
assert mirrors_obj.mirrors.build_cache_mirror == [mirror for mirror in valid_mirrors.values() if mirror.get('buildcache')]
3028
# assert disabled mirror not in mirrors
31-
for mir in mirrors:
29+
for mir in mirrors_obj.mirrors:
3230
assert mir["enabled"]
3331
# test that cmdline_cache gets added to mirrors?
3432

0 commit comments

Comments
 (0)