Skip to content

Commit 2ffa056

Browse files
committed
tests: Adds common setup steps
There are 2 types of tests being run: single node, and multi node. Adds GitHub actions for these 2 types of scenarios, with the common steps for those scenarios. This should make future tests easier to write and review. Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
1 parent 5f545a9 commit 2ffa056

File tree

3 files changed

+207
-395
lines changed

3 files changed

+207
-395
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: MicroCeph Test Multi Node Setup
2+
description: Common setup steps for MicroCeph multi node testing
3+
4+
inputs:
5+
container-network-name:
6+
description: Container network name for create_containers.
7+
required: false
8+
default: "public"
9+
10+
ceph-release:
11+
description: |
12+
Ceph release to be installed from the store. If empty, the local
13+
microceph snap will be installed instead.
14+
required: false
15+
default: ""
16+
17+
bootstrap-parameters:
18+
description: |
19+
Space-separated parameters to be used for the "Bootstrap" step.
20+
Skipped if empty.
21+
required: false
22+
default: bootstrap_head public
23+
24+
setup-cluster-parameters:
25+
description: |
26+
Space-separated parameters to be used for the "Setup cluster" step.
27+
Skipped if empty.
28+
required: false
29+
default: public
30+
31+
osd-count:
32+
description: Number of OSDs to add. Skipped if 0.
33+
required: false
34+
default: 0
35+
36+
runs:
37+
using: "composite"
38+
steps:
39+
- name: Download snap
40+
uses: actions/download-artifact@v4
41+
with:
42+
name: snaps
43+
path: /home/runner
44+
45+
- name: Copy utils
46+
shell: bash
47+
run: cp tests/scripts/actionutils.sh $HOME
48+
49+
- name: Clear FORWARD firewall rules
50+
shell: bash
51+
run: ~/actionutils.sh cleaript
52+
53+
- name: Free disk
54+
shell: bash
55+
run: ~/actionutils.sh free_runner_disk
56+
57+
- name: Install dependencies
58+
shell: bash
59+
run: ~/actionutils.sh setup_lxd
60+
61+
- name: Create containers with loopback devices
62+
shell: bash
63+
run: ~/actionutils.sh create_containers ${{ inputs.container-network-name }}
64+
65+
- name: Install ceph release from store
66+
if: "${{ inputs.ceph-release != '' }}"
67+
shell: bash
68+
run: ~/actionutils.sh install_store ${{ inputs.ceph-release }}
69+
70+
- name: Install local microceph snap
71+
if: "${{ inputs.ceph-release == '' }}"
72+
shell: bash
73+
run: ~/actionutils.sh install_multinode
74+
75+
- name: Bootstrap
76+
if: "${{ inputs.bootstrap-parameters != '' }}"
77+
shell: bash
78+
run: ~/actionutils.sh ${{ inputs.bootstrap-parameters }}
79+
80+
- name: Setup cluster
81+
if: "${{ inputs.setup-cluster-parameters != '' }}"
82+
shell: bash
83+
run: ~/actionutils.sh cluster_nodes ${{ inputs.setup-cluster-parameters }}
84+
85+
- name: Add and wait for OSDs
86+
if: ${{ inputs.osd-count != 0 }}
87+
shell: bash
88+
run: |
89+
set -uex
90+
for i in $(seq 0 $[${{ inputs.osd-count }} - 1]) ; do
91+
~/actionutils.sh add_osd_to_node "node-wrk$i"
92+
done
93+
94+
~/actionutils.sh headexec wait_for_osds ${{ inputs.osd-count }}
95+
96+
lxc exec node-wrk0 -- sh -c "microceph.ceph -s"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: MicroCeph Test Single Node Setup
2+
description: Common setup steps for MicroCeph single node testing
3+
4+
inputs:
5+
osd-count:
6+
description: Number of OSDs to add. Skipped if 0.
7+
required: false
8+
default: 0
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Download snap
14+
uses: actions/download-artifact@v4
15+
with:
16+
name: snaps
17+
path: /home/runner
18+
19+
- name: Copy utils
20+
shell: bash
21+
run: cp tests/scripts/actionutils.sh $HOME
22+
23+
- name: Clear FORWARD firewall rules
24+
shell: bash
25+
run: ~/actionutils.sh cleaript
26+
27+
- name: Free disk
28+
shell: bash
29+
run: ~/actionutils.sh free_runner_disk
30+
31+
- name: Install local microceph snap
32+
shell: bash
33+
run: ~/actionutils.sh "install_microceph"
34+
35+
- name: Add loopback file OSDs
36+
if: ${{ inputs.osd-count != 0 }}
37+
shell: bash
38+
run: |
39+
set -uex
40+
41+
sudo microceph disk add loop,1G,${{ inputs.osd-count }}
42+
~/actionutils.sh wait_for_osds ${{ inputs.osd-count }}
43+
44+
sudo microceph.ceph -s

0 commit comments

Comments
 (0)