From c1ac0ade1c392d28cfdf422bfb5d6fafe07336fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Thu, 31 Oct 2024 12:39:46 +0100 Subject: [PATCH] Clean up examples, remove deprecated execute method (#3330) The `shell` execute method has been dropped a long time ago. Let's get rid of the last mentions. Also remove some irrelevant outdated examples which were part of the initial brainstorming. Update several examples to make them actually working. --- examples/environment/main.fmf | 7 +++-- examples/httpd/smoke.fmf | 2 +- examples/l2/.fmf/version | 1 - examples/l2/artifacts.fmf | 19 ----------- examples/l2/bed.fmf | 20 ------------ examples/l2/gating.fmf | 30 ------------------ examples/l2/rpmdiff.fmf | 20 ------------ examples/l2/simple.fmf | 16 ---------- examples/l2/tooling.fmf | 32 ------------------- examples/l2/workflow.fmf | 59 ----------------------------------- examples/rtt/.fmf/version | 1 - examples/rtt/install.fmf | 31 ------------------ examples/rtt/post-install.fmf | 8 ----- examples/together/main.fmf | 8 ++--- spec/plans/main.fmf | 6 ++-- stories/cli/run.fmf | 4 +-- 16 files changed, 14 insertions(+), 250 deletions(-) delete mode 100644 examples/l2/.fmf/version delete mode 100644 examples/l2/artifacts.fmf delete mode 100644 examples/l2/bed.fmf delete mode 100644 examples/l2/gating.fmf delete mode 100644 examples/l2/rpmdiff.fmf delete mode 100644 examples/l2/simple.fmf delete mode 100644 examples/l2/tooling.fmf delete mode 100644 examples/l2/workflow.fmf delete mode 100644 examples/rtt/.fmf/version delete mode 100644 examples/rtt/install.fmf delete mode 100644 examples/rtt/post-install.fmf diff --git a/examples/environment/main.fmf b/examples/environment/main.fmf index 5d53afb645..fe40e5c6e5 100644 --- a/examples/environment/main.fmf +++ b/examples/environment/main.fmf @@ -3,12 +3,15 @@ Environment variable. description: Tests can be provided with a list of environment variables. + discover: + how: fmf execute: - how: shell + how: tmt /test: summary: Just a simple test - test: ./test.sh + test: + echo "x = '$x', y = '$y', z = '$z'" environment: x: That's nice! y: a b c diff --git a/examples/httpd/smoke.fmf b/examples/httpd/smoke.fmf index 0906f25d85..bcb589440f 100644 --- a/examples/httpd/smoke.fmf +++ b/examples/httpd/smoke.fmf @@ -11,7 +11,7 @@ prepare: how: shell script: systemctl start httpd execute: - how: shell + how: tmt script: - echo foo > /var/www/html/index.html - curl http://localhost/ | grep foo diff --git a/examples/l2/.fmf/version b/examples/l2/.fmf/version deleted file mode 100644 index d00491fd7e..0000000000 --- a/examples/l2/.fmf/version +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/examples/l2/artifacts.fmf b/examples/l2/artifacts.fmf deleted file mode 100644 index bc153ece3c..0000000000 --- a/examples/l2/artifacts.fmf +++ /dev/null @@ -1,19 +0,0 @@ -# Basic structure of artifacts and related testsets -/test: - /pull-request: - /pep: - summary: All code must comply with the PEP8 style guide - /lint: - summary: Run pylint to catch common problems (no gating) - /build: - /smoke: - summary: Basic smoke test (Tier1) - /features: - summary: Verify important features - /update: - /basic: - summary: Run all Tier1, Tier2 and Tier3 tests - /security: - summary: Security tests (extra job to get quick results) - /integration: - summary: Integration tests with related components diff --git a/examples/l2/bed.fmf b/examples/l2/bed.fmf deleted file mode 100644 index 36d19673a0..0000000000 --- a/examples/l2/bed.fmf +++ /dev/null @@ -1,20 +0,0 @@ -# Tests which need a fresh test bed for each -/test/build/smoke: - summary: Basic smoke test - # List tests manually - discover: - how: list - tests: - - test/one - - test/two - - test/three - # Setup with ansible - prepare: - how: ansible - playbook: - - 'dependencies.yml' - - 'selenium.yml' - # Use restraint with isolation enabled - execute: - how: restraint - isolate: true diff --git a/examples/l2/gating.fmf b/examples/l2/gating.fmf deleted file mode 100644 index 9b3c4bf283..0000000000 --- a/examples/l2/gating.fmf +++ /dev/null @@ -1,30 +0,0 @@ -# Turn on gating for selected testsets (defined inline) -/test: - /pull-request: - /pep: - summary: All code must comply with the PEP8 style guide - # Do not allow ugly code to be merged into the main branch - gate: - - merge-pull-request - /lint: - summary: Run pylint to catch common problems (no gating) - /build: - /smoke: - summary: Basic smoke test (Tier1) - # Basic smoke test is used by three gates - gate: - - merge-pull-request - - add-build-to-update - - add-build-to-compose - /features: - summary: Verify important features - /update: - # This enables the 'release-update' gate for all three testsets - gate: - - release-update - /basic: - summary: Run all Tier1, Tier2 and Tier3 tests - /security: - summary: Security tests (extra job to get quick results) - /integration: - summary: Integration tests with related components diff --git a/examples/l2/rpmdiff.fmf b/examples/l2/rpmdiff.fmf deleted file mode 100644 index ccdfcdecab..0000000000 --- a/examples/l2/rpmdiff.fmf +++ /dev/null @@ -1,20 +0,0 @@ -# Basic example of an rpmdiff per-package config -/test: - /build: - /rpmdiff-essential: - summary: Essential rpmdiff tests (used for gating) - execute: - how: rpmdiff - tests: - - ABI symbols - - File permissions - gate: - - add-build-to-update - - add-build-to-compose - /rpmdiff-additional: - summary: Additional rpmdiff tests (informational) - execute: - how: rpmdiff - tests: - - File list - - Specfile checks diff --git a/examples/l2/simple.fmf b/examples/l2/simple.fmf deleted file mode 100644 index 2fce84fe28..0000000000 --- a/examples/l2/simple.fmf +++ /dev/null @@ -1,16 +0,0 @@ -# Simple use cases should be super simple to write -/test: - /pull-request: - /validate: - prepare: - requires: python3-pep8 - execute: - how: shell - command: pep8 *.py - /build: - /smoke: - discover: - how: fmf - repo: https://src.fedoraproject.org/tests/tar.git - execute: - how: restraint diff --git a/examples/l2/tooling.fmf b/examples/l2/tooling.fmf deleted file mode 100644 index c6bd74eef7..0000000000 --- a/examples/l2/tooling.fmf +++ /dev/null @@ -1,32 +0,0 @@ -# Multiple tool support for test discovery & execution -/test: - /build: - # Standard Test Interface - /sti: - execute: - how: sti - playbook: - - 'tests.yml' - tag: - - 'classic' - # Simple shell script - /shell: - execute: - how: shell - path: 'tests' - test: './test.sh' - environment: - PYTHON: 'python2' - # Workflow Tomorrow - /wow: - execute: - how: wow - options: '--plan 1234 --tags Tier1' - # Flexible Metadata Format + Restraint - /fmf: - discover: - how: fmf - filter: 'tier: 1, 2' - url: https://src.fedoraproject.org/tests/python - execute: - how: restraint diff --git a/examples/l2/workflow.fmf b/examples/l2/workflow.fmf deleted file mode 100644 index a40115e500..0000000000 --- a/examples/l2/workflow.fmf +++ /dev/null @@ -1,59 +0,0 @@ -# Workflow steps: discover, provision, prepare, execute, report -/test: - # Discover relevant tests - discover: - how: fmf - # System requirements - provision: - memory: - min: '1 GB' - arch: - - 'x86_64' - # Machine configuration - prepare: - ansible: - - 'setup.yml' - # Test execution - execute: - how: restraint - # Result reporting - report: - contact: email@address.org - - # Build testing - /build: - /smoke: - summary: Basic smoke test (Tier1) - discover+: - filter: 'tier: 1' - /features: - summary: Verify important features - discover+: - filter: 'tag: functional' - - # Errata testing - /update: - provision+: - arch: - - x86_64 - - ppc64 - - s390x - /basic: - summary: Run all Tier1, Tier2 and Tier3 tests - discover+: - filter: 'tier: 1, 2, 3' - /security: - summary: Security tests (extra job to get quick results) - discover+: - filter: 'tag: security' - /integration: - summary: Integration tests with related components - discover+: - filter: 'tag: integration' - provision+: - memory: - min: '4 GB' - max: '8 GB' - prepare: - ansible: - - 'integration.yml' diff --git a/examples/rtt/.fmf/version b/examples/rtt/.fmf/version deleted file mode 100644 index d00491fd7e..0000000000 --- a/examples/rtt/.fmf/version +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/examples/rtt/install.fmf b/examples/rtt/install.fmf deleted file mode 100644 index 51e2faed6f..0000000000 --- a/examples/rtt/install.fmf +++ /dev/null @@ -1,31 +0,0 @@ - -# common settings -discover: - summary: Postinstall checks - how: list - tests: check1, check2, check3 -provision: - summary: Special RTT provisioning - how: rtt-magic -execute: - how: shell - -# pxe install -/pxe: - summary: "Test pxe installation" - provision+: - method: pxe - /simple: - provision+: - setup: simple - /complex: - provision+: - setup: complex - -# http install -/http: - summary: "Test http installation" - provision+: - method: http - discover+: - tests: check1, check2 diff --git a/examples/rtt/post-install.fmf b/examples/rtt/post-install.fmf deleted file mode 100644 index e945df2d7b..0000000000 --- a/examples/rtt/post-install.fmf +++ /dev/null @@ -1,8 +0,0 @@ -test: ./test.sh - -/check1: - summary: Post installation check one -/check2: - summary: Post installation check two -/check3: - summary: Post installation check three diff --git a/examples/together/main.fmf b/examples/together/main.fmf index 2cd530a01c..66f1f5dc74 100644 --- a/examples/together/main.fmf +++ b/examples/together/main.fmf @@ -5,15 +5,13 @@ discover: how: fmf prepare: - how: ansible - playbook: packages.yaml + how: install + package: [python3, make] execute: - how: shell + how: tmt /tests: /smoke: test: python3 -c "import time" - path: / /full: test: make check - path: / diff --git a/spec/plans/main.fmf b/spec/plans/main.fmf index 49147fdd74..31b1df10fe 100644 --- a/spec/plans/main.fmf +++ b/spec/plans/main.fmf @@ -54,7 +54,7 @@ example: | how: shell script: systemctl start httpd execute: - how: shell + how: tmt script: - - echo foo > /var/www/html/index.html - - curl http://localhost/ | grep foo + - echo foo > /var/www/html/index.html + - curl http://localhost/ | grep foo diff --git a/stories/cli/run.fmf b/stories/cli/run.fmf index d835d8586e..dd1ee5ce45 100644 --- a/stories/cli/run.fmf +++ b/stories/cli/run.fmf @@ -43,7 +43,7 @@ story: 'As a user I want to execute tests easily' discover: how: fmf execute: - how: shell + how: tmt /default/plan: summary: @@ -51,7 +51,7 @@ story: 'As a user I want to execute tests easily' discover: how: shell execute: - how: shell + how: tmt link: - implemented-by: /tmt/base.py - verified-by: /tests/run/default