diff --git a/.github/workflows/test-module.yml b/.github/workflows/test-module.yml index 6f9f6e9..64fb228 100644 --- a/.github/workflows/test-module.yml +++ b/.github/workflows/test-module.yml @@ -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 }} \ No newline at end of file diff --git a/tests/api.resource b/tests/api.resource new file mode 100644 index 0000000..e6b90ee --- /dev/null +++ b/tests/api.resource @@ -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} \ No newline at end of file diff --git a/tests/ejabberd.robot b/tests/ejabberd.robot index 883ec2d..f8b5924 100644 --- a/tests/ejabberd.robot +++ b/tests/ejabberd.robot @@ -1,5 +1,6 @@ *** Settings *** Library SSHLibrary +Resource api.resource *** Test Cases *** Check if ejabberd is installed correctly @@ -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":"user1@ejabberd.org,user2@ejabberd.org","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