Skip to content

Commit

Permalink
chore: Update test-module.yml to use DigitalOcean infrastructure for …
Browse files Browse the repository at this point in the history
…testing

Add the `test-on-digitalocean-infra.yml` workflow file to the `run_tests` job in `test-module.yml`. This change allows the tests to be run on DigitalOcean infrastructure. The DigitalOcean token is now stored as a secret.
  • Loading branch information
stephdl committed May 17, 2024
1 parent 88d7ee9 commit dfec643
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ jobs:
uses: NethServer/ns8-github-actions/.github/workflows/module-info.yml@main
run_tests:
needs: module
uses: NethServer/ns8-github-actions/.github/workflows/test-on-ubuntu-runner.yml@main
uses: NethServer/ns8-github-actions/.github/workflows/test-on-digitalocean-infra.yml@main
with:
args: "ghcr.io/${{needs.module.outputs.owner}}/${{needs.module.outputs.name}}:${{needs.module.outputs.tag}}"
repo_ref: ${{needs.module.outputs.sha}}
debug_shell: ${{ github.event.inputs.debug_shell == 'true' || false }}
secrets:
do_token: ${{ secrets.do_token }}
14 changes: 14 additions & 0 deletions tests/api.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*** Settings ***
Library SSHLibrary

*** Keywords ***
Run task
[Arguments] ${action} ${input} ${decode_json}=${TRUE} ${rc_expected}=0
${stdout} ${stderr} ${rc} = Execute Command api-cli run ${action} --data '${input}' return_stdout=True return_stderr=True return_rc=True
Should Be Equal As Integers ${rc_expected} ${rc} Run task ${action} failed!${\n}${stderr}
IF ${decode_json} and len($stdout) > 0
${response} = Evaluate json.loads('''${stdout}''') modules=json
ELSE
${response} = Set Variable ${stdout}
END
[Return] ${response}
5 changes: 3 additions & 2 deletions tests/ejabberd.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 ejabberd is installed correctly
Expand All @@ -10,12 +11,12 @@ Check if ejabberd is installed correctly
Set Suite Variable ${module_id} ${output.module_id}

Check if ejabberd 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 '{"hostname":"ejabberd.org","ldap_domain":"nethserver.org","adminsList":"[email protected],[email protected]","http_upload":true,"s2s":true,"shaper_normal":500000,"shaper_fast":1000000,"mod_http_upload_unlimited":true,"mod_mam_status":true,"purge_mnesia_unlimited":false,"purge_mnesia_interval":30,"lets_encrypt":true,"purge_httpd_upload_interval":31,"webadmin":false}'
... return_rc=True return_stdout=False
Should Be Equal As Integers ${rc} 0

Check if ejabberd works as expected
${rc} = Execute Command curl -f http://127.0.0.1/ejabberd/
${rc} = Execute Command curl -k https://localhost:5280/api/status
... return_rc=True return_stdout=False
Should Be Equal As Integers ${rc} 0

Expand Down

0 comments on commit dfec643

Please sign in to comment.