From 939233e4e49d8f666717be249b07bdcbee962e37 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 6 Jul 2022 05:54:55 +1000 Subject: [PATCH] paste : move testing host to paste99, remove https hacks Move the paste testing server to paste99 to distinguish it in testing from the actual production paste service. Since we have certificates setup now, we can directly test against "paste99.opendev.org", removing the insecure flags to various calls. Change-Id: Ifd5e270604102806736dffa86dff2bf8b23799c5 --- inventory/service/group_vars/paste.yaml | 3 +++ .../host_vars/paste01.opendev.org.yaml | 3 --- .../handlers/main.yaml | 3 +++ playbooks/zuul/run-base.yaml | 2 +- .../host_vars/paste01.opendev.org.yaml.j2 | 2 -- .../host_vars/paste99.opendev.org.yaml.j2 | 7 +++++++ testinfra/test_paste.py | 19 ++++++------------- zuul.d/system-config-run.yaml | 2 +- 8 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 inventory/service/group_vars/paste.yaml delete mode 100644 playbooks/zuul/templates/host_vars/paste01.opendev.org.yaml.j2 create mode 100644 playbooks/zuul/templates/host_vars/paste99.opendev.org.yaml.j2 diff --git a/inventory/service/group_vars/paste.yaml b/inventory/service/group_vars/paste.yaml new file mode 100644 index 0000000000..5745b3db1e --- /dev/null +++ b/inventory/service/group_vars/paste.yaml @@ -0,0 +1,3 @@ +borg_backup_excludes_extra: + # live db; dumped with mysqldump + - /var/lib/lodgeit diff --git a/inventory/service/host_vars/paste01.opendev.org.yaml b/inventory/service/host_vars/paste01.opendev.org.yaml index 4f25e8809b..b2ef6cff36 100644 --- a/inventory/service/host_vars/paste01.opendev.org.yaml +++ b/inventory/service/host_vars/paste01.opendev.org.yaml @@ -3,6 +3,3 @@ letsencrypt_certs: - paste01.opendev.org - paste.opendev.org - paste.openstack.org -borg_backup_excludes_extra: - # live db; dumped with mysqldump - - /var/lib/lodgeit diff --git a/playbooks/roles/letsencrypt-create-certs/handlers/main.yaml b/playbooks/roles/letsencrypt-create-certs/handlers/main.yaml index 618b89fc39..a8d1e4b352 100644 --- a/playbooks/roles/letsencrypt-create-certs/handlers/main.yaml +++ b/playbooks/roles/letsencrypt-create-certs/handlers/main.yaml @@ -171,6 +171,9 @@ - name: letsencrypt updated paste01-opendev-org-main include_tasks: roles/letsencrypt-create-certs/handlers/restart_apache.yaml +- name: letsencrypt updated paste99-opendev-org-main + include_tasks: roles/letsencrypt-create-certs/handlers/restart_apache.yaml + # review - name: letsencrypt updated review02-opendev-org-main diff --git a/playbooks/zuul/run-base.yaml b/playbooks/zuul/run-base.yaml index 23a619593e..a9a5aabd4f 100644 --- a/playbooks/zuul/run-base.yaml +++ b/playbooks/zuul/run-base.yaml @@ -148,7 +148,7 @@ - host_vars/mirror01.openafs.provider.opendev.org.yaml - host_vars/mirror02.openafs.provider.opendev.org.yaml - host_vars/mirror-update01.opendev.org.yaml - - host_vars/paste01.opendev.org.yaml + - host_vars/paste99.opendev.org.yaml - host_vars/refstack01.openstack.org.yaml - host_vars/review99.opendev.org.yaml - name: Display group membership diff --git a/playbooks/zuul/templates/host_vars/paste01.opendev.org.yaml.j2 b/playbooks/zuul/templates/host_vars/paste01.opendev.org.yaml.j2 deleted file mode 100644 index 58a6dbe079..0000000000 --- a/playbooks/zuul/templates/host_vars/paste01.opendev.org.yaml.j2 +++ /dev/null @@ -1,2 +0,0 @@ -lodgeit_secret_key: secretkey -lodgeit_db_password: password diff --git a/playbooks/zuul/templates/host_vars/paste99.opendev.org.yaml.j2 b/playbooks/zuul/templates/host_vars/paste99.opendev.org.yaml.j2 new file mode 100644 index 0000000000..11d2ff17c9 --- /dev/null +++ b/playbooks/zuul/templates/host_vars/paste99.opendev.org.yaml.j2 @@ -0,0 +1,7 @@ +lodgeit_secret_key: secretkey +lodgeit_db_password: password +letsencrypt_certs: + paste99-opendev-org-main: + - paste99.opendev.org + - paste.opendev.org + - paste.openstack.org diff --git a/testinfra/test_paste.py b/testinfra/test_paste.py index a2652e0d57..2e175feb91 100644 --- a/testinfra/test_paste.py +++ b/testinfra/test_paste.py @@ -16,7 +16,7 @@ import requests from util import take_screenshots -testinfra_hosts = ['paste01.opendev.org'] +testinfra_hosts = ['paste99.opendev.org'] def test_lodgeit_container_web_listening(host): @@ -27,9 +27,7 @@ def test_lodgeit_container_web_listening(host): assert paste_https.is_listening def test_paste(host): - cmd = host.run('curl --insecure ' - '--resolve paste.opendev.org:443:127.0.0.1 ' - 'https://paste.opendev.org') + cmd = host.run('curl https://paste99.opendev.org') assert 'New Paste' in cmd.stdout # ensure we paste private by default assert '' \ @@ -37,27 +35,22 @@ def test_paste(host): def test_paste_redirects(host): # http site should redirect all agents but Pastebinit - r = requests.get( - 'http://%s' % host.backend.get_hostname(), allow_redirects=False) + r = requests.get('http://paste99.opendev.org', allow_redirects=False) assert r.status_code == 301 assert r.headers['Location'] == 'https://paste.opendev.org/' headers = { 'User-Agent': 'Pastebinit v1.2.3' } - r = requests.get('http://%s' % (host.backend.get_hostname())) + r = requests.get('http://paste99.opendev.org') assert r.status_code == 200 def test_paste_logo(host): - cmd = host.run('curl --insecure ' - '--resolve paste.opendev.org:443:127.0.0.1 ' - 'https://paste.opendev.org/assets/opendev.svg') + cmd = host.run('curl https://paste99.opendev.org/assets/opendev.svg') assert 'image/svg+xml' in cmd.stdout def test_paste_robots(host): - cmd = host.run('curl --insecure ' - '--resolve paste.opendev.org:443:127.0.0.1 ' - 'https://paste.opendev.org/robots.txt') + cmd = host.run('curl https://paste99.opendev.org/robots.txt') assert 'Disallow: /' in cmd.stdout def test_paste_screenshots(host): diff --git a/zuul.d/system-config-run.yaml b/zuul.d/system-config-run.yaml index e58feb7434..9c303d47af 100644 --- a/zuul.d/system-config-run.yaml +++ b/zuul.d/system-config-run.yaml @@ -778,7 +778,7 @@ nodes: - name: bridge.openstack.org label: ubuntu-bionic - - name: paste01.opendev.org + - name: paste99.opendev.org label: ubuntu-focal vars: run_playbooks: