Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 4 additions & 37 deletions .github/workflows/test-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,10 @@ on:
types: [completed]

jobs:
module:
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == '' }}
uses: NethServer/ns8-github-actions/.github/workflows/module-info.yml@v1

chooser:
runs-on: ubuntu-latest
outputs:
node_a: ${{ steps.pick.outputs.node_a }}
node_b: ${{ steps.pick.outputs.node_b }}
steps:
- id: pick
run: |
if (( $GITHUB_RUN_NUMBER % 2 )); then
echo "node_a=rl1" >> "$GITHUB_OUTPUT"
echo "node_b=dn1" >> "$GITHUB_OUTPUT"
else
echo "node_a=dn1" >> "$GITHUB_OUTPUT"
echo "node_b=rl1" >> "$GITHUB_OUTPUT"
fi

run_tests:
needs: [module, chooser]
strategy:
fail-fast: false
matrix:
scenario: [install, update]
uses: NethServer/ns8-github-actions/.github/workflows/test-on-digitalocean-infra.yml@v1
run:
name: "Run tests"
uses: NethServer/ns8-github-actions/.github/workflows/test-module.yml@refactor-testing
with:
coremodules: ${{ matrix.scenario == 'install' && format('ghcr.io/{0}/{1}:{2}', needs.module.outputs.owner, needs.module.outputs.name, needs.module.outputs.tag) || '' }}
leader_nodes: >-
${{
matrix.scenario == 'install'
&& needs.chooser.outputs.node_a
|| needs.chooser.outputs.node_b
}}
args: ${{ format('ghcr.io/{0}/{1}:{2} -v SCENARIO:{3}', needs.module.outputs.owner, needs.module.outputs.name, needs.module.outputs.tag, matrix.scenario) }}
repo_ref: ${{ needs.module.outputs.sha }}
debug_shell: ${{ github.event.inputs.debug_shell == 'true' || false }}
debug_shell: ${{ github.event.inputs.debug_shell == 'true' }}
secrets:
do_token: ${{ secrets.do_token }}
38 changes: 1 addition & 37 deletions test-module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later
#

set -e -a

SSH_KEYFILE=${SSH_KEYFILE:-$HOME/.ssh/id_rsa}

LEADER_NODE="${1:?missing LEADER_NODE argument}"
IMAGE_URL="${2:?missing IMAGE_URL argument}"
shift 2

ssh_key="$(< $SSH_KEYFILE)"
venvroot=/usr/local/venv

podman run -i \
--volume=.:/srv/source:z \
--volume=rftest-cache:${venvroot}:z \
--replace --name=rftest \
--env=ssh_key \
--env=venvroot \
--env=LEADER_NODE \
--env=IMAGE_URL \
docker.io/python:3.11-alpine \
ash -l -s -- "${@}" <<'EOF'
set -e
echo "$ssh_key" > /tmp/idssh
if [ ! -x ${venvroot}/bin/robot ] ; then
python3 -mvenv ${venvroot} --upgrade
${venvroot}/bin/pip3 install -q -r /srv/source/tests/pythonreq.txt
fi
cd /srv/source
mkdir -vp tests/outputs/
exec ${venvroot}/bin/robot \
-v NODE_ADDR:${LEADER_NODE} \
-v IMAGE_URL:${IMAGE_URL} \
-v SSH_KEYFILE:/tmp/idssh \
--name mail \
--skiponfailure unstable \
-d tests/outputs "${@}" tests/
EOF
echo "Local test file to be removed ////"
34 changes: 34 additions & 0 deletions tests/15__ui.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
*** Settings ***
Library Browser

*** Variables ***
${ADMIN_USER} admin
${ADMIN_PASSWORD} Nethesis,1234
${MODULE_ID} ${EMPTY}

*** Keywords ***

Login to cluster-admin
New Page https://${NODE_ADDR}/cluster-admin/
Fill Text text="Username" ${ADMIN_USER}
Click button >> text="Continue"
Fill Text text="Password" ${ADMIN_PASSWORD}
Click button >> text="Log in"
Wait For Elements State css=#main-content visible timeout=10s

*** Test Cases ***

Take screenshots
[Tags] ui
New Browser chromium headless=True
New Context ignoreHTTPSErrors=True
Login to cluster-admin
Go To https://${NODE_ADDR}/cluster-admin/#/apps/${MID}
Wait For Elements State iframe >>> h2 >> text="Status" visible timeout=10s
Sleep 5s
Take Screenshot filename=${OUTPUT DIR}/browser/screenshot/status.png
Go To https://${NODE_ADDR}/cluster-admin/#/apps/${MID}?page=settings
Wait For Elements State iframe >>> h2 >> text="Settings" visible timeout=10s
Sleep 5s
Take Screenshot filename=${OUTPUT DIR}/browser/screenshot/settings.png
Close Browser
86 changes: 0 additions & 86 deletions tests/20__dovecot.robot

This file was deleted.

10 changes: 0 additions & 10 deletions tests/20__rspamd.robot

This file was deleted.

10 changes: 0 additions & 10 deletions tests/30__clamav.robot

This file was deleted.

30 changes: 0 additions & 30 deletions tests/30__postfix.robot

This file was deleted.

35 changes: 0 additions & 35 deletions tests/40__api/10__domains.robot

This file was deleted.

79 changes: 0 additions & 79 deletions tests/40__api/20__addresses.robot

This file was deleted.

Loading
Loading