Fix the Ansible Galaxy proxy testinfra test
Previously we checked that "Ansible Galaxy" shows up in the html result requesting the root of the Galaxy proxy. This now fails and looking at the results of the fetch the title of the page is "Galaxy NG". Update our test to check for "Galaxy NG" instead. Additionally our content checks of actual collections are affected by an api bump from v2 to v3. Among other things this appears to be a completely new implementation that does not have backward compatible support for v2 and may require authentication to use. I've commented out our old test content for the content checks and someone will need to fix this later. Change-Id: I6b17eea82ac95200ba5069de74e9a7dc30d6fed8
This commit is contained in:
parent
53fe07271c
commit
3a4ce1bd08
@ -67,28 +67,32 @@ def test_quay_mirror(host):
|
|||||||
|
|
||||||
def test_galaxy_mirror(host):
|
def test_galaxy_mirror(host):
|
||||||
cmd = host.run(_run_cmd(host, 4448, url='/'))
|
cmd = host.run(_run_cmd(host, 4448, url='/'))
|
||||||
assert 'Ansible Galaxy' in cmd.stdout
|
assert 'Galaxy NG' in cmd.stdout
|
||||||
|
|
||||||
cmd = host.run(_run_cmd(host, 8085, scheme='http', url='/'))
|
cmd = host.run(_run_cmd(host, 8085, scheme='http', url='/'))
|
||||||
assert 'Ansible Galaxy' in cmd.stdout
|
assert 'Galaxy NG' in cmd.stdout
|
||||||
|
|
||||||
hostname = host.backend.get_hostname()
|
hostname = host.backend.get_hostname()
|
||||||
# Ensure API properly answers
|
# Ensure API properly answers
|
||||||
cmd = host.run(_run_cmd(host, 4448, url='/api/'))
|
cmd = host.run(_run_cmd(host, 4448, url='/api/'))
|
||||||
assert 'GALAXY REST API' in cmd.stdout
|
assert 'galaxy_ng_version' in cmd.stdout
|
||||||
# Ensure we get data out of a specific collection
|
|
||||||
cmd = host.run(_run_cmd(host, 4448, url='/api/v2/collections/community/general/'))
|
# TODO(clarkb) fix the testing of galaxy api proxying.
|
||||||
assert 'https://{}:4448/api/'.format(hostname) in cmd.stdout
|
# Galaxy completely redid their apis in v3 and the tests below are
|
||||||
answer = json.loads(cmd.stdout)
|
# no longer valid.
|
||||||
version_uri = answer['latest_version']['href'].replace('https://{}:4448'.format(hostname), '')
|
## Ensure we get data out of a specific collection
|
||||||
# Ensure we get a correct download URI
|
#cmd = host.run(_run_cmd(host, 4448, url='/api/v2/collections/community/general/'))
|
||||||
cmd = host.run(_run_cmd(host, 4448, url=version_uri))
|
#assert 'https://{}:4448/api/'.format(hostname) in cmd.stdout
|
||||||
assert 'https://{}:4448/api/'.format(hostname) in cmd.stdout
|
#answer = json.loads(cmd.stdout)
|
||||||
answer = json.loads(cmd.stdout)
|
#version_uri = answer['latest_version']['href'].replace('https://{}:4448'.format(hostname), '')
|
||||||
download_uri = answer['download_url']
|
## Ensure we get a correct download URI
|
||||||
assert download_uri.startswith('https://{}:4448/download/community-general'.format(hostname))
|
#cmd = host.run(_run_cmd(host, 4448, url=version_uri))
|
||||||
# Download a file and check we get an actual archive
|
#assert 'https://{}:4448/api/'.format(hostname) in cmd.stdout
|
||||||
download_uri = download_uri.replace('https://{}:4448'.format(hostname), '')
|
#answer = json.loads(cmd.stdout)
|
||||||
host.run(_run_cmd(host, 4448, url=download_uri, curl_opt='-sL --output /tmp/output.tar.gz'))
|
#download_uri = answer['download_url']
|
||||||
check_file = host.run('file /tmp/output.tar.gz')
|
#assert download_uri.startswith('https://{}:4448/download/community-general'.format(hostname))
|
||||||
assert 'gzip compressed data' in check_file.stdout
|
## Download a file and check we get an actual archive
|
||||||
|
#download_uri = download_uri.replace('https://{}:4448'.format(hostname), '')
|
||||||
|
#host.run(_run_cmd(host, 4448, url=download_uri, curl_opt='-sL --output /tmp/output.tar.gz'))
|
||||||
|
#check_file = host.run('file /tmp/output.tar.gz')
|
||||||
|
#assert 'gzip compressed data' in check_file.stdout
|
||||||
|
Loading…
Reference in New Issue
Block a user