Skip to content

Commit

Permalink
Add test plan in .ci dir to customize it per each role
Browse files Browse the repository at this point in the history
  • Loading branch information
spetrosi committed Feb 10, 2025
1 parent 3dc49b9 commit a950e7b
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 2 deletions.
1 change: 1 addition & 0 deletions .ci/.fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
108 changes: 108 additions & 0 deletions .ci/general.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
summary: A general test for a system role
tag: general
provision:
- name: control-node1
role: control_node
# TF uses `how: artemis`, tmt try uses `how: virtual`. No need to define `how`
# `connection: system` is for `how: virtual` to make VMs get a real IP to configure ssh easily
# This setting is ignored on artemis so we can keep it
connection: system
- name: managed-node1
role: managed_node
connection: system
hardware:
network:
- type: eth
- type: eth
- name: managed-node2
role: managed_node
connection: system
hardware:
network:
- type: eth
- type: eth
- name: managed-node3
role: managed_node
connection: system
hardware:
network:
- type: eth
- type: eth
- name: managed-node4
role: managed_node
connection: system
hardware:
network:
- type: eth
- type: eth
- name: managed-node5
role: managed_node
connection: system
hardware:
network:
- type: eth
- type: eth
- name: managed-node6
role: managed_node
connection: system
hardware:
network:
- type: eth
- type: eth
environment:
ANSIBLE_VER: 2.17
REPO_NAME: network
PYTHON_VERSION: 3.12
SYSTEM_ROLES_ONLY_TESTS: ""
TEST_LOCAL_CHANGES: false
PR_NUM: ""
LINUXSYSTEMROLES_USER: ""
LINUXSYSTEMROLES_DOMAIN: ""
LINUXSYSTEMROLES_SSH_KEY: ""
ARTIFACTS_DIR: ""
ARTIFACTS_URL: ""
LSR_TFT_DEBUG: false
prepare:
- name: Use vault.centos.org repos (CS 7, 8 EOL workaround)
script: |
if grep -q 'CentOS Stream release 8' /etc/redhat-release; then
sed -i '/^mirror/d;s/#\(baseurl=http:\/\/\)mirror/\1vault/' /etc/yum.repos.d/*.repo
fi
if grep -q 'CentOS Linux release 7.9' /etc/redhat-release; then
sed -i '/^mirror/d;s/#\?\(baseurl=http:\/\/\)mirror/\1vault/' /etc/yum.repos.d/*.repo
fi
# Replace with feature: epel: enabled once https://github.com/teemtee/tmt/pull/3128 is merged
- name: Enable epel to install beakerlib
script: |
# CS 10 and Fedora doesn't require epel
if grep -q -e 'CentOS Stream release 10' -e 'Fedora release' /etc/redhat-release; then
exit 0
fi
yum install epel-release yum-utils -y
yum-config-manager --enable epel epel-debuginfo epel-source
- name: Test NICs
script: lshw -C network
discover:
- name: Prepare managed node
how: fmf
where: managed_node
filter: tag:prep_managed_node
url: https://github.com/linux-system-roles/tft-tests
ref: main
- name: Run test playbooks from control_node
how: fmf
where: control_node
filter: tag:test_playbooks
url: https://github.com/linux-system-roles/tft-tests
ref: main
# Uncomment this step for troubleshooting
# This is required because currently testing-farm cli doesn't support running multi-node plans
# You can set ID_RSA_PUB in the environment section above to your public key to distribute it to nodes
# - name: Inject your ssh public key to test systems
# how: fmf
# where: control_node
# filter: tag:reserve_system
# url: https://github.com/linux-system-roles/tft-tests
# ref: main
execute:
how: tmt
3 changes: 1 addition & 2 deletions .github/workflows/tft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ jobs:
uses: sclorg/testing-farm-as-github-action@v3
if: contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
with:
git_url: https://github.com/linux-system-roles/tft-tests
git_ref: main
tmt_path: .ci
pipeline_settings: '{ "type": "tmt-multihost" }'
environment_settings: '{ "provisioning": { "tags": { "BusinessUnit": "system_roles" } } }'
# Keeping ARTIFACTS_URL at the bottom makes the link in logs clickable
Expand All @@ -180,7 +180,6 @@ jobs:
tf_scope: private
api_key: ${{ secrets.TF_API_KEY_RH }}
update_pull_request_status: false
tmt_hardware: '{ "memory": ">= ${{ needs.prepare_vars.outputs.memory }} MB", "network": [{"type": "eth", "device-name": "eth0"}, {"type": "eth", "device-name": "eth1"}] }'
tmt_plan_filter: "tag:general,network"

- name: Set final commit status
Expand Down

0 comments on commit a950e7b

Please sign in to comment.