Skip to content

Commit

Permalink
feat: Add api.resource to SSHLibrary test in postgresql.robot
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed May 22, 2024
1 parent f65c415 commit 454d443
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions tests/postgresql.robot
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*** Settings ***
Library SSHLibrary
Resource api.resource

*** Test Cases ***
Check if postgresql is installed correctly
Expand All @@ -10,16 +11,30 @@ Check if postgresql is installed correctly
Set Suite Variable ${module_id} ${output.module_id}

Check if postgresql can be configured
${rc} = Execute Command api-cli run module/${module_id}/configure-module --data '{}'
${rc} = Execute Command api-cli run module/${module_id}/configure-module --data '{"host":"postgresql.domain.org","http2https": true,"lets_encrypt": true}'
... return_rc=True return_stdout=False
Should Be Equal As Integers ${rc} 0

Check if postgresql works as expected
${rc} = Execute Command curl -f http://127.0.0.1/postgresql/
... return_rc=True return_stdout=False
Should Be Equal As Integers ${rc} 0
Check postgresql path is configured
${ocfg} = Run task module/${module_id}/get-configuration {}
Set Suite Variable ${HOST} ${ocfg['host']}
Set Suite Variable ${HTTP2HTTPS} ${ocfg['http2https']}
Set Suite Variable ${LE_ENCRYPT} ${ocfg['lets_encrypt']}
Should Not Be Empty ${HOST}
Should Be True ${HTTP2HTTPS}
Should Be True ${LE_ENCRYPT}

Check if posgresql works as expected
Wait Until Keyword Succeeds 20 times 3 seconds Ping postgresql

Check if postgresql is removed correctly
${rc} = Execute Command remove-module --no-preserve ${module_id}
... return_rc=True return_stdout=False
Should Be Equal As Integers ${rc} 0

*** Keywords ***
Ping postgresql
${out} ${err} ${rc} = Execute Command curl -k -f -H 'Host: postgresql.domain.org' https://127.0.0.1/login
... return_rc=True return_stdout=True return_stderr=True
Should Be Equal As Integers ${rc} 0
Should Contain ${out} <title>pgAdmin

0 comments on commit 454d443

Please sign in to comment.