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
12 changes: 12 additions & 0 deletions .github/workflows/e2e-tests-provision-and-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ on:
type: string
required: false
default: ''
authd-ppa:
description: 'If set, use this PPA instead of authd-edge when installing the authd package and its dependencies'
type: string
required: false
default: ''
e2e-tests-description:
description: 'PR description containing an optional e2e-tests: suite list'
type: string
required: false
default: ''
secrets:
E2E_VM_SSH_PRIV_KEY:
required: true
Expand Down Expand Up @@ -152,4 +162,6 @@ jobs:
ubuntu-version: ${{ inputs.ubuntu-version }}
broker: ${{ matrix.broker }}
broker-snap-channel: ${{ inputs.broker-snap-channel }}
authd-ppa: ${{ inputs.authd-ppa }}
e2e-tests-description: ${{ inputs.e2e-tests-description }}
secrets: inherit
23 changes: 23 additions & 0 deletions .github/workflows/e2e-tests-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ on:
required: false
type: string
default: ''
authd-ppa:
description: 'If set, use this PPA instead of authd-edge when installing the authd package and its dependencies'
required: false
type: string
default: ''
e2e-tests-description:
description: 'PR description containing an optional e2e-tests: suite list'
required: false
type: string
default: ''
secrets:
E2E_VM_SSH_PRIV_KEY:
required: true
Expand Down Expand Up @@ -199,6 +209,7 @@ jobs:
# broker credentials from the environment)
${{ env.E2E_TESTS_DIR }}/vm/provision-authd.sh \
--authd-deb "${{ steps.download-authd-deb.outputs.deb }}" \
${{ inputs.authd-ppa && format('--authd-ppa {0}', inputs.authd-ppa) || '' }} \
--broker-snap "${{ steps.download-broker-snap-from-store.outputs.snap || steps.download-broker-snap-from-oci.outputs.snap }}"

- name: Checkout YARF repo
Expand All @@ -218,6 +229,7 @@ jobs:
env:
RELEASE: ${{ inputs.ubuntu-version }}
BROKER: ${{ inputs.broker }}
E2E_TESTS_DESCRIPTION: ${{ inputs.e2e-tests-description }}
run: |
set -eux
export PATH="$(realpath "${{ env.E2E_TESTS_DIR }}/vm/helpers"):${PATH}"
Expand All @@ -234,8 +246,19 @@ jobs:
export TOTP_SECRET="${{ secrets.E2E_GOOGLE_TOTP_SECRET }}"
fi

e2e_tests=()
while IFS= read -r test; do
e2e_tests+=("$test")
done < <(
sed -nE \
's/^[[:space:]]*e2e-tests:[[:space:]]*(.+)[[:space:]]*$/\1/p' \
<<< "${E2E_TESTS_DESCRIPTION}" \
| tr ' ' '\n'
)

${{ env.E2E_TESTS_DIR }}/run-tests.sh \
--output-dir "${{ env.OUTPUT_DIR }}" \
-- "${e2e_tests[@]}" \
|| exit_code=$?

if [ -n "${exit_code:-}" ]; then
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ on:
- synchronize
- reopened
- labeled
- edited
workflow_dispatch:
inputs:
broker-snap-channel:
Expand Down Expand Up @@ -110,4 +111,21 @@ jobs:
files-hash: ${{ needs.compute-hash.outputs.files-hash }}
force-fresh-image: ${{ github.event_name == 'schedule' }}
broker-snap-channel: ${{ inputs.broker-snap-channel || '' }}
# PRs opt in by adding "e2e-ppa: authd-dev" to their description.
authd-ppa: >-
${{
github.event_name == 'pull_request' &&
contains(
github.event.pull_request.body,
'e2e-ppa: authd-dev'
) &&
'ubuntu-enterprise-desktop/authd-dev' || ''
}}
# PRs can limit the suites by adding, for example,
# "e2e-tests: login_gdm.robot login_cli.robot" to their description.
e2e-tests-description: >-
${{
github.event_name == 'pull_request' &&
github.event.pull_request.body || ''
}}
secrets: inherit
17 changes: 16 additions & 1 deletion e2e-tests/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,25 @@ default Ubuntu release and VM name prefix).
This sets up a libvirt VM with Ubuntu, installs authd and the broker, and
creates the snapshots required by the tests. By default, authd is installed from
the edge PPA and the broker from the edge channel snap. Use `--authd-deb` to
install a locally built authd package, or `--broker-snap` to install a locally
install a locally built authd package, `--authd-ppa <ppa>` to select a different
PPA for authd and its dependencies, or `--broker-snap` to install a locally
built broker snap. Run `./e2e-tests/vm/provision.sh --help` for all available
options, including `--force` to reprovision.

When running the tests in GitHub CI, add `e2e-ppa: authd-dev` to the pull request
description to install the authd package and its dependencies from the
`ubuntu-enterprise-desktop/authd-dev` PPA instead of `authd-edge`.

To run only selected end-to-end test suites in GitHub CI, add an `e2e-tests:`
line to the pull request description, followed by a space-separated list of
suite filenames:

```text
e2e-tests: login_gdm.robot login_cli.robot
```

Without this marker, GitHub CI runs the complete end-to-end test suite.

### 4. Set up YARF

```bash
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ while [[ $# -gt 0 ]]; do
;;
--)
shift
TESTS_TO_RUN+=("$@")
break
;;
-*)
Expand Down
14 changes: 10 additions & 4 deletions e2e-tests/vm/provision-authd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DATA_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/authd-e2e-tests"

usage(){
cat << EOF
Usage: $0 [--config-file <file>] [--release <release>] [--authd-deb <deb>] [--broker-snap <snap>]
Usage: $0 [--config-file <file>] [--release <release>] [--authd-deb <deb>] [--authd-ppa <ppa>] [--broker-snap <snap>]

Options:
--config-file <file> Path to the configuration file (default: config.env)
Expand All @@ -18,6 +18,8 @@ Options:
The existing snapshots will be deleted and recreated with the new installation.
--broker <broker> The broker to install ("authd-google", "authd-msentraid", ...)
--authd-deb <deb> Path to the authd deb file to install (default: install from the edge PPA)
--authd-ppa <ppa> PPA to use instead of authd-edge when installing authd
and its dependencies
--broker-snap <snap> Path to the broker snap file to install (default: install from the edge channel)
-h, --help Show this help message and exit

Expand Down Expand Up @@ -47,6 +49,10 @@ while [[ $# -gt 0 ]]; do
AUTHD_DEB="$2"
shift 2
;;
--authd-ppa)
AUTHD_PPA="$2"
shift 2
;;
--broker-snap)
BROKER_SNAP="$2"
shift 2
Expand Down Expand Up @@ -292,9 +298,9 @@ fi
# Revert to the pre-authd setup snapshot before installing the version to test
restore_snapshot_and_sync_time "$PRE_AUTHD_SNAPSHOT"

# Add the edge PPA. We also need that when installing authd from a deb file,
# because it depends on gnome-shell from the edge PPA.
PPA="ubuntu-enterprise-desktop/authd-edge"
# Add the PPA needed to resolve dependencies for the authd package under test.
# authd-edge remains the default for local and normal CI runs.
PPA="${AUTHD_PPA:-ubuntu-enterprise-desktop/authd-edge}"
$SSH "add-apt-repository -y ppa:${PPA}"

# Configure authd to be verbose. We do this before installing authd to avoid
Expand Down
8 changes: 7 additions & 1 deletion e2e-tests/vm/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ CONFIG_FILE="${SCRIPT_DIR}/config.env"

usage(){
cat << EOF
Usage: $0 [--config-file <config file>] [--release <release>] [--broker <broker>] [--authd-deb <deb>] [--broker-snap <snap>] [--force]
Usage: $0 [--config-file <config file>] [--release <release>] [--broker <broker>] [--authd-deb <deb>] [--authd-ppa <ppa>] [--broker-snap <snap>] [--force]

Options:
--config-file <config file> Path to the configuration file (default: config.env)
--release <release> Ubuntu release to provision (e.g. noble, resolute); overrides config file
--broker <broker> The broker to install ("authd-google", "authd-msentraid", ...)
--authd-deb <deb> Path to the authd deb file to install (default: install from the edge PPA)
--authd-ppa <ppa> PPA to use instead of authd-edge when installing authd and its dependencies
--broker-snap <snap> Path to the broker snap file to install (default: install from the edge channel)
--force Force provisioning: remove existing VM and artifacts and create a fresh VM
-h, --help Show this help message and exit
Expand Down Expand Up @@ -45,6 +46,10 @@ while [[ $# -gt 0 ]]; do
AUTHD_DEB="$2"
shift 2
;;
--authd-ppa)
AUTHD_PPA="$2"
shift 2
;;
--broker-snap)
BROKER_SNAP="$2"
shift 2
Expand Down Expand Up @@ -78,5 +83,6 @@ set -x
${RELEASE_ARG:+--release "${RELEASE_ARG}"} \
${BROKER:+--broker "${BROKER}"} \
${AUTHD_DEB:+--authd-deb "${AUTHD_DEB}"} \
${AUTHD_PPA:+--authd-ppa "${AUTHD_PPA}"} \
${BROKER_SNAP:+--broker-snap "${BROKER_SNAP}"} \
${FORCE:+--force}
Loading