Enable GCS urls as valid (#29592)
* Add tests to ensure google cloud storage urls work as mirrors This commit adds two tests to track that GCS buckets can work as mirrors, and can be parsed as valid URLs. Currently, gs:// format URLs are not correctly parsed. * Fix URL parsing for GCS buckets This commit adds GCS bucket URLs as valid URLs.
This commit is contained in:
parent
26552533be
commit
9b0d5cbabf
@ -210,6 +210,13 @@ def test_mirror_crud(tmp_scope, capsys):
|
||||
output = mirror('list', '--scope', tmp_scope)
|
||||
assert 'No mirrors configured' in output
|
||||
|
||||
# Test GCS Mirror
|
||||
mirror('add', '--scope', tmp_scope,
|
||||
'mirror', 'gs://spack-test')
|
||||
|
||||
output = mirror('remove', '--scope', tmp_scope, 'mirror')
|
||||
assert 'Removed mirror' in output
|
||||
|
||||
|
||||
def test_mirror_nonexisting(tmp_scope):
|
||||
with pytest.raises(SpackCommandError):
|
||||
|
@ -59,6 +59,11 @@ def test_url_parse():
|
||||
assert(parsed.netloc == 'path')
|
||||
assert(parsed.path == '/to/resource')
|
||||
|
||||
parsed = url_util.parse('gs://path/to/resource')
|
||||
assert(parsed.scheme == 'gs')
|
||||
assert(parsed.netloc == 'path')
|
||||
assert(parsed.path == '/to/resource')
|
||||
|
||||
spack_root = spack.paths.spack_root
|
||||
parsed = url_util.parse('file://$spack')
|
||||
assert(parsed.scheme == 'file')
|
||||
|
@ -343,7 +343,7 @@ def parse_git_url(url):
|
||||
|
||||
|
||||
def require_url_format(url):
|
||||
ut = re.search(r'^(file://|http://|https://|ftp://|s3://|/)', url)
|
||||
ut = re.search(r'^(file://|http://|https://|ftp://|s3://|gs://|/)', url)
|
||||
assert ut is not None
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user