forked from canonical/microceph
-
Notifications
You must be signed in to change notification settings - Fork 0
716 lines (568 loc) · 20.3 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
name: Tests
on:
- push
- pull_request
jobs:
build-microceph:
name: Build microceph snap
runs-on: ubuntu-22.04
env:
SNAPCRAFT_BUILD_ENVIRONMENT: "lxd"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Copy utils
run: cp tests/scripts/actionutils.sh $HOME
- name: Clear FORWARD firewall rules
run: ~/actionutils.sh cleaript
- name: Install dependencies
run: |
~/actionutils.sh setup_lxd
sudo snap install snapcraft --classic
snap list
- name: Build snaps
run: snapcraft
- name: Upload snap artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: snaps
path: "*.snap"
retention-days: 5
unit-tests:
name: Run Unit tests
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo add-apt-repository ppa:dqlite/dev -y --no-update
sudo apt-get update
sudo apt-get install -y libdqlite-dev
- name: Install Go (1.21)
uses: actions/setup-go@v5
with:
go-version: 1.21.x
- name: Run unit-tests
run: |
cd microceph
make check-unit
single-system-tests:
name: Single node with encryption
runs-on: ubuntu-22.04
needs: build-microceph
steps:
- name: Download snap
uses: actions/download-artifact@v3
with:
name: snaps
path: /home/runner
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Copy utils
run: cp tests/scripts/actionutils.sh $HOME
- name: Free disk
run: ~/actionutils.sh free_runner_disk
- name: Install and setup
run: |
~/actionutils.sh install_microceph
set -uex
# Verify metadata.yaml
meta=/var/snap/microceph/current/conf/metadata.yaml
cat $meta
grep -q ceph-version $meta
# Verify health and auto crush rule
sudo microceph.ceph health | grep -q "OSD count 0 < osd_pool_default_size 3"
sudo microceph.ceph osd crush rule ls | grep -F microceph_auto_osd
- name: Add OSD with failure
run: |
set -eux
loop_file="$(sudo mktemp -p /mnt XXXX.img)"
sudo truncate -s 1G "${loop_file}"
loop_dev="$(sudo losetup --show -f "${loop_file}")"
minor="${loop_dev##/dev/loop}"
sudo mknod -m 0660 "/dev/sdi21" b 7 "${minor}"
set +e
rc=$(sudo microceph disk add --wipe "/dev/sdi21" --encrypt |& grep -c Failure)
if [[ $rc -eq 0 ]] ; then echo "FDE should fail without dmcrypt: $rc"; exit 1; fi
# actually creating additional loop devices is not required since this should fail in validation.
rc=$(sudo microceph disk add "/dev/sdi21" "/dev/sdi22" --wal-device "/dev/sdi23" |& grep -c "not supported for batch disk addition")
if [[ $rc -eq 0 ]] ; then echo "Batch disk addition should fail with wal device: $rc"; exit 1; fi
rc=$(sudo microceph disk add "/dev/sdi21" "/dev/sdi22" --db-device "/dev/sdi23" |& grep -c "not supported for batch disk addition")
if [[ $rc -eq 0 ]] ; then echo "Batch disk addition should fail with db device: $rc"; exit 1; fi
- name: Add OSDs
run: |
~/actionutils.sh add_encrypted_osds
~/actionutils.sh add_lvm_vol
- name: Enable RGW
run: ~/actionutils.sh enable_rgw
- name: Run system tests
run: |
set -eux
# List disks
sudo microceph disk list
# Show ceph's status
sudo microceph.ceph status
# Ceph status expectations for a single node cluster
test_single() {
local status="$1"
( echo "$status" | grep -qF "mon: 1 daemons" ) || { echo fail ; return ; }
( echo "$status" | grep -qE "mgr: .*active, " )|| { echo fail ; return ; }
( echo "$status" | grep -qF "osd: 3 osds" ) || { echo fail ; return ; }
( echo "$status" | grep -qF "rgw: 1 daemon" ) || { echo fail ; return ; }
echo ok
}
# Confirm ceph is healthy and services started
res=$( test_single "$( sudo microceph.ceph status )" )
[ $res = "ok" ] || { echo "single node status fails" ; exit 1 ; }
# Check health after restart
sudo snap stop microceph
sudo snap start microceph
for i in $(seq 1 16); do
status=$( sudo microceph.ceph status )
echo "$status"
res=$( test_single "$status" )
if [ $res = "ok" ] ; then
echo "Single tests pass"
break
else
echo "Single tests fail, retry $i/16"
sleep 15
fi
done
sleep 1
pgrep ceph-osd || { echo "No ceph-osd process found" ; exit 1; }
- name: Exercise RGW
run: ~/actionutils.sh testrgw
- name: Disable RGW
run: ~/actionutils.sh disable_rgw
- name: Enable RGW with SSL enabled
run: ~/actionutils.sh enable_rgw_ssl
- name: Exercise RGW with SSL enabled
run: ~/actionutils.sh testrgw_ssl
- name: Test Cluster Config
run: |
set -eux
cip=$(ip -4 -j route | jq -r '.[] | select(.dst | contains("default")) | .prefsrc' | tr -d '[:space:]')
# pre config set timestamp for service age
ts=$(sudo systemctl show --property ActiveEnterTimestampMonotonic snap.microceph.osd.service | cut -d= -f2)
# set config
sudo microceph cluster config set cluster_network $cip/8 --wait
# post config set timestamp for service age
ts2=$(sudo systemctl show --property ActiveEnterTimestampMonotonic snap.microceph.osd.service | cut -d= -f2)
# Check config output
output=$(sudo microceph cluster config get cluster_network | grep -cim1 'cluster_network')
if [[ $output -lt 1 ]] ; then echo "config check failed: $output"; exit 1; fi
# Check service restarted
if [ $ts2 -lt $ts ]; then echo "config check failed: TS1: $ts2 TS2: $ts3"; exit 1; fi
# reset config
sudo microceph cluster config reset cluster_network --wait
# post config reset timestamp for service age
ts3=$(sudo systemctl show --property ActiveEnterTimestampMonotonic snap.microceph.osd.service | cut -d= -f2)
# Check service restarted
if [ $ts3 -lt $ts2 ]; then echo "config check failed: TS2: $ts2 TS3: $ts3"; exit 1; fi
- name: Test pool operations
run: |
set +e
sudo microceph.ceph osd pool create mypool
sudo microceph pool set-rf --size 1 ""
sudo microceph.ceph config get osd.1 osd_pool_default_size | fgrep -x "1"
sudo microceph pool list | fgrep "mypool" | fgrep -q " 3 "
sudo microceph pool set-rf --size 3 mypool
sudo microceph.ceph osd pool get mypool size | fgrep -x "size: 3"
sudo microceph pool list | fgrep "mypool" | fgrep -q " 3 "
sudo microceph pool set-rf --size 1 "*"
sudo microceph.ceph osd pool get mypool size | fgrep -x "size: 1"
sudo microceph pool list | fgrep "mypool" | fgrep -q " 1 "
- name: Test log operations
run: |
set +e
sudo microceph log set-level warning
output=$(sudo microceph log get-level)
if [[ "$output" != "3" ]] ; then echo "incorrect log level: $output"; exit 1; fi
- name: Print logs for failure
if: failure()
run: |
sudo snap logs microceph -n 1000
multi-node-tests:
name: Multi node testing
runs-on: ubuntu-22.04
needs: build-microceph
steps:
- name: Download snap
uses: actions/download-artifact@v3
with:
name: snaps
path: /home/runner
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Copy utils
run: cp tests/scripts/actionutils.sh $HOME
- name: Clear FORWARD firewall rules
run: ~/actionutils.sh cleaript
- name: Free disk
run: ~/actionutils.sh free_runner_disk
- name: Install dependencies
run: ~/actionutils.sh setup_lxd
- name: Create containers with loopback devices
run: ~/actionutils.sh create_containers public
- name: Install local microceph snap
run: ~/actionutils.sh install_multinode
- name: Bootstrap
run: ~/actionutils.sh bootstrap_head public
- name: Setup cluster
run: ~/actionutils.sh cluster_nodes public
- name: Verify config
run: ~/actionutils.sh test_ceph_conf
- name: Add 2 OSDs
run: |
for c in node-wrk1 node-wrk2 ; do
~/actionutils.sh add_osd_to_node $c
done
lxc exec node-wrk0 -- sh -c "microceph.ceph -s"
- name: Exercise microceph status
run: |
set -uex
lxc exec node-wrk0 -- sh -c "sudo microceph status"
- name: Test failure domain scale up
run: |
set -uex
# We still have failure domain OSD
lxc exec node-wrk0 -- sh -c "sudo microceph.ceph config get mon osd_pool_default_crush_rule" | fgrep -x 1
# Add a 3rd OSD, should switch to host failure domain
~/actionutils.sh add_osd_to_node node-wrk0
~/actionutils.sh headexec wait_for_osds 3
sleep 1
lxc exec node-wrk0 -- sh -c "sudo microceph.ceph -s"
# Now default to host rule
lxc exec node-wrk0 -- sh -c "sudo microceph.ceph config get mon osd_pool_default_crush_rule" | fgrep -x 2
- name: Test 3 osds present
run: |
set -uex
lxc exec node-wrk0 -- sh -c "microceph.ceph -s" | egrep "osd: 3 osds: 3 up.*3 in"
- name: Test crush rules
run: |
set -uex
lxc exec node-wrk0 -- sh -c "microceph.ceph osd crush rule ls" | grep -F microceph_auto_host
lxc exec node-wrk0 -- sh -c "microceph.ceph osd pool ls detail" | grep -F "crush_rule 2"
- name: Add another OSD
run: |
~/actionutils.sh add_osd_to_node node-wrk3
~/actionutils.sh headexec wait_for_osds 4
- name: Remove OSD again
run: |
set -uex
lxc exec node-wrk0 -- sh -c "microceph disk remove 4"
lxc exec node-wrk0 -- sh -c "microceph.ceph -s" | egrep "osd: 3 osds: 3 up.*3 in"
- name: Test migrate services
run: |
set -uex
~/actionutils.sh test_migration node-wrk1 node-wrk3
- name: Enable services on wrk1
run: ~/actionutils.sh headexec enable_services node-wrk1
- name: Remove OSD again but don't scaledown crush rule.
run: |
set -uex
lxc exec node-wrk0 -- sh -c "microceph disk remove 3 --prohibit-crush-scaledown --bypass-safety-checks"
lxc exec node-wrk0 -- sh -c "microceph.ceph osd crush rule ls" | grep -F microceph_auto_host
- name: Re-Add OSD
run: |
set -uex
~/actionutils.sh add_osd_to_node node-wrk0
~/actionutils.sh headexec wait_for_osds 3
- name: Test remove node wrk3
run: |
set -uex
~/actionutils.sh headexec remove_node node-wrk3
if lxc exec node-wrk0 -- sh -c "microceph status" | grep -q "^- node-wrk3 " ; then
echo "Failed: node-wrk3 still present"
exit 1
fi
output=$(lxc exec node-wrk0 -- sh -c "microceph.ceph -s")
(echo $output | fgrep "mon: 3 daemons") ||
(echo $output | grep "mon: 4 daemons.*out of quorum: node-wrk3")
- name: Test client configurations
run: ~/actionutils.sh check_client_configs
- name: Print logs for failure
if: failure()
run: |
sudo snap logs microceph -n 1000
multi-node-tests-with-custom-microceph-ip:
name: Multi node testing with custom microceph IP
runs-on: ubuntu-22.04
needs: build-microceph
steps:
- name: Download snap
uses: actions/download-artifact@v3
with:
name: snaps
path: /home/runner
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Copy utils
run: cp tests/scripts/actionutils.sh $HOME
- name: Clear FORWARD firewall rules
run: ~/actionutils.sh cleaript
- name: Free disk
run: ~/actionutils.sh free_runner_disk
- name: Install dependencies
run: ~/actionutils.sh setup_lxd
- name: Create containers with loopback devices
run: ~/actionutils.sh create_containers internal
- name: Install local microceph snap
run: ~/actionutils.sh install_multinode
- name: Bootstrap
run: ~/actionutils.sh bootstrap_head internal
- name: Setup cluster
run: ~/actionutils.sh cluster_nodes internal
- name: Add 3 OSDs
run: |
for c in node-wrk0 node-wrk1 node-wrk2 ; do
~/actionutils.sh add_osd_to_node $c
done
- name: Test 3 osds present
run: |
set -uex
~/actionutils.sh headexec wait_for_osds 3
lxc exec node-wrk0 -- sh -c "microceph.ceph -s"
- name: Print logs for failure
if: failure()
run: |
sudo snap logs microceph -n 1000
loop-file-tests:
name: Test with loopback file OSDs
runs-on: ubuntu-22.04
needs: build-microceph
steps:
- name: Download snap
uses: actions/download-artifact@v3
with:
name: snaps
path: /home/runner
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Copy utils
run: cp tests/scripts/actionutils.sh $HOME
- name: Clear FORWARD firewall rules
run: ~/actionutils.sh cleaript
- name: Free disk
run: ~/actionutils.sh free_runner_disk
- name: Install and setup
run: ~/actionutils.sh install_microceph
- name: Add loopback file OSDs
run: |
set -uex
sudo microceph disk add loop,1G,4
~/actionutils.sh wait_for_osds 4
sudo microceph.ceph -s
- name: Enable RGW
run: ~/actionutils.sh enable_rgw
- name: Exercise RGW
run: ~/actionutils.sh testrgw
- name: Remove OSD
run: |
set -uex
sudo microceph disk remove osd.1
~/actionutils.sh wait_for_osds 3
sudo microceph.ceph -s
- name: Print logs for failure
if: failure()
run: |
sudo snap logs microceph -n 1000
wal-db-tests:
name: Test WAL/DB device usage
runs-on: ubuntu-22.04
needs: build-microceph
steps:
- name: Download snap
uses: actions/download-artifact@v3
with:
name: snaps
path: /home/runner
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Copy utils
run: cp tests/scripts/actionutils.sh $HOME
- name: Clear FORWARD firewall rules
run: ~/actionutils.sh cleaript
- name: Free disk
run: ~/actionutils.sh free_runner_disk
- name: Install and setup
run: ~/actionutils.sh install_microceph
- name: Add loopback file OSDs
run: |
set -uex
sudo microceph disk add loop,1G,3
~/actionutils.sh wait_for_osds 3
sudo microceph.ceph -s
- name: Add WAL/DB enabled OSD
run: |
set -uex
~/actionutils.sh create_loop_devices
sudo microceph disk list
sudo microceph disk add /dev/sdia --wal-device /dev/sdib --db-device /dev/sdic
~/actionutils.sh wait_for_osds 4
sudo microceph.ceph -s
- name: Check that disk list doesn't contain WAL/DB blockdevs
run: |
set -uex
sudo microceph disk list
for d in sdb sdc ; do
if sudo microceph disk list | grep -q /dev/$d ; then
echo "Error: found WAL/DB device: /dev/$d"
exit 1
fi
done
- name: Enable RGW
run: ~/actionutils.sh enable_rgw
- name: Exercise RGW
run: ~/actionutils.sh testrgw
- name: Print logs for failure
if: failure()
run: |
sudo snap logs microceph -n 1000
upgrade-quincy-tests:
name: Test quincy upgrades
runs-on: ubuntu-22.04
needs: build-microceph
steps:
- name: Download snap
uses: actions/download-artifact@v3
with:
name: snaps
path: /home/runner
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Copy utils
run: cp tests/scripts/actionutils.sh $HOME
- name: Clear FORWARD firewall rules
run: ~/actionutils.sh cleaript
- name: Free disk
run: ~/actionutils.sh free_runner_disk
- name: Install dependencies
run: ~/actionutils.sh setup_lxd
- name: Create containers with loopback devices
run: ~/actionutils.sh create_containers public
- name: Install quincy stable from store
run: ~/actionutils.sh install_store quincy/stable
- name: Bootstrap
run: ~/actionutils.sh bootstrap_head
- name: Setup cluster
run: ~/actionutils.sh cluster_nodes
- name: Add 3 OSDs
run: |
for c in node-wrk0 node-wrk1 node-wrk2 ; do
~/actionutils.sh add_osd_to_node $c
done
~/actionutils.sh headexec wait_for_osds 3
- name: Enable RGW
run: ~/actionutils.sh headexec enable_rgw
- name: Exercise RGW
run: ~/actionutils.sh headexec testrgw
- name: Install local build
run: ~/actionutils.sh upgrade_multinode
- name: Wait until 3 OSDs are up
run: ~/actionutils.sh headexec wait_for_osds 3
- name: Exercise RGW again
run: ~/actionutils.sh headexec testrgw
- name: Exercise microceph status
run: |
set -uex
lxc exec node-wrk0 -- sh -c "sudo microceph status"
cluster-tests:
name: Test MicroCeph Cluster features.
runs-on: ubuntu-22.04
needs: build-microceph
steps:
- name: Download snap
uses: actions/download-artifact@v3
with:
name: snaps
path: /home/runner
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Copy utils
run: cp tests/scripts/actionutils.sh $HOME
- name: Clear FORWARD firewall rules
run: ~/actionutils.sh cleaript
- name: Free disk
run: ~/actionutils.sh free_runner_disk
- name: Install and setup
run: ~/actionutils.sh install_microceph
- name: Add loopback file OSDs
run: |
set -uex
sudo microceph disk add loop,1G,3
~/actionutils.sh wait_for_osds 3
sudo microceph.ceph -s
- name: Enable RGW
run: ~/actionutils.sh enable_rgw
- name: Exercise RGW
run: ~/actionutils.sh testrgw
- name: Bombard MicroCeph with cluster configs
run: ~/actionutils.sh bombard_rgw_configs
- name: Exercise RGW again
run: ~/actionutils.sh testrgw "newFile"
replication-tests:
name: Test MicroCeph Remote Replication features.
runs-on: ubuntu-22.04
needs: build-microceph
steps:
- name: Download snap
uses: actions/download-artifact@v3
with:
name: snaps
path: /home/runner
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Copy utils
run: cp tests/scripts/actionutils.sh $HOME
- name: Clear FORWARD firewall rules
run: ~/actionutils.sh cleaript
- name: Free disk
run: ~/actionutils.sh free_runner_disk
- name: Install dependencies
run: ~/actionutils.sh setup_lxd
- name: Create containers with loopback devices
run: ~/actionutils.sh create_containers public
- name: Install local microceph snap
run: ~/actionutils.sh install_multinode
- name: Bootstrap
run: ~/actionutils.sh remote_simple_bootstrap_two_sites
- name: Exchange Cluster tokens
run: ~/actionutils.sh remote_exchange_site_tokens
- name: Verify Remote authentication
run: ~/actionutils.sh remote_perform_remote_ops_check
- name: Enable RBD Mirror Daemon
run : ~/actionutils.sh remote_enable_rbd_mirror_daemon
- name: Configure RBD mirror
run : ~/actionutils.sh remote_configure_rbd_mirroring
- name: Wait for RBD mirror to sync images
run : ~/actionutils.sh remote_wait_for_secondary_to_sync
- name: Verify RBD mirror
run : ~/actionutils.sh remote_verify_rbd_mirroring
- name: Disable RBD mirror
run : ~/actionutils.sh remote_disable_rbd_mirroring
- name: Verify Remote removal
run: ~/actionutils.sh remote_remove_and_verify