Skip to content
Snippets Groups Projects
Commit c8e9342a authored by Jörg Sachse's avatar Jörg Sachse
Browse files

test: add tests to verify CGI binaries work as expected (with more to implement)

parent 91056754
No related merge requests found
Pipeline #5303 failed
...@@ -36,4 +36,4 @@ test-job: ...@@ -36,4 +36,4 @@ test-job:
- molecule create --scenario-name default - molecule create --scenario-name default
- molecule converge --scenario-name default - molecule converge --scenario-name default
- molecule idempotence --scenario-name default - molecule idempotence --scenario-name default
# - molecule verify --scenario-name default - molecule verify --scenario-name default
--- ---
# This is an example playbook to execute Ansible tests.
- name: Verify - name: Verify
hosts: all hosts: all
gather_facts: false gather_facts: false
tasks: tasks:
- name: Example assertion - name: get result for CGI-Binaries
ansible.builtin.command:
cmd: "/usr/lib/cgi-bin/{{ item }}"
loop:
- "convert_to"
- "is_valid"
register: cgi_binaries
changed_when: false
# The return code is 1 when calling the CGI-Binaries on the commandline,
# because the environment is not right and we're not PUTting a PDF file, so
# we expect failure. That's OK, we just want to see if it crashes or
# returns a nice HTML structure.
# This test does NOT tell us anything about the use of the correct
# libcgicc version. To do this, we would need to upload a file to tcp/8080
# and observe apache2/error.log output. If you feel up to the task of
# writing an appropriate test, please feel free to do so.
# If you try, expect the following apache error messages:
# [Thu Oct 19 13:28:12.252241 2023] [cgid:error] [pid 34681:tid 140007369025216] [client 10.0.2.2:56994] End of script output before headers: is_valid, referer: http://localhost:8080/cgi-bin/is_valid/pdfa
# terminate called after throwing an instance of 'PTB::exc'
# what(): The PDF file is corrupt, it could not be opened
failed_when: false
- name: evaluate return code and message for CGI-Binaries
ansible.builtin.assert: ansible.builtin.assert:
that: true that:
- ( 'Content-Type: text/html' in item.stdout )
- ( '<html><head' in item.stdout )
quiet: true
loop: "{{ cgi_binaries.results }}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment