Skip to content

Commit

Permalink
Add test for controller certificate change
Browse files Browse the repository at this point in the history
The test does the following:
1. deploy first app with userdata to EVE
2. create new signing certificate for controller
3. update controller's certificate and resign old config
4. deploy second app with userdata
5. reboot EVE
6. deploy third app with userdata
7. make sure all apps are running correclty

Signed-off-by: Paul Gaiduk <[email protected]>
  • Loading branch information
europaul committed Mar 4, 2024
1 parent 58c76f5 commit 9440875
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 4 deletions.
81 changes: 81 additions & 0 deletions tests/eclient/testdata/ctrl_cert_change.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Test of controller certificate change
# This test validates the re-encryption of an application's user data
# following a change in the controller's certificate, accompanied by an edge node reboot.
# The test involves deploying three applications to make sure the config is (re)applied to all of them.

{{$port := "2223"}}

{{$userdata := "variable=value"}}
{{define "eclient_image"}}docker://{{EdenConfig "eden.eclient.image"}}:{{EdenConfig "eden.eclient.tag"}}{{end}}

[!exec:bash] stop
[!exec:sleep] stop
[!exec:chmod] stop

exec chmod 600 {{EdenConfig "eden.tests"}}/eclient/image/cert/id_rsa

eden network create 10.11.12.0/24 -n n1
eden pod deploy -n eclient1 --memory=512MB --networks=n1 {{template "eclient_image"}} -p {{$port}}:22 --metadata={{$userdata}}

test eden.app.test -test.v -timewait 20m RUNNING eclient1

# generate new controller certificate
eden utils gen-signing-cert -o /tmp/signing-new.pem

# upload new certificate to controller, resign old config and reapply it
eden adam change-signing-cert --cert-file /tmp/signing-new.pem

# wait for changes to be applied
test eden.lim.test -test.v -timewait 15m -test.run TestLog -out content 'content:Rebuilding.intended.global.config,.reasons:.reconnecting.app'

eden pod deploy -n eclient2 --memory=512MB --networks=n1 {{template "eclient_image"}} --metadata={{$userdata}}

test eden.app.test -test.v -timewait 20m RUNNING eclient2

# check EVE got the new signing certificate
exec -t 2m bash check_sign_cert.sh

# send reboot command and wait in background
test eden.reboot.test -test.v -timewait=20m -reboot=1 -count=1 &

# wait for HALTED state which indicates that we are rebooting
test eden.app.test -test.v -timewait 5m HALTED eclient1
test eden.app.test -test.v -timewait 5m HALTED eclient2

Check failure on line 43 in tests/eclient/testdata/ctrl_cert_change.txt

View workflow job for this annotation

GitHub Actions / Execute Eden test workflow / Smoke tests (zfs, false)

[stdout] Docker app's state test === RUN TestAppStatus apps: '[eclient2]' state: 'HALTED' secs: 300 time: 2024-03-04T13:40:26.932561232Z out: appName eclient2 state changed to HALTING app_test.go:171: ASSERTION FAILED (2024-03-04T13:45:26.933622264Z): expected apps [eclient2] in HALTED state app_test.go:173: actual eclient2: HALTING app_test.go:175: history of states for eclient2: app_test.go:177: state: no info from controller received in: 2024-03-04T13:40:26.921395416Z app_test.go:177: state: HALTING received in: 2024-03-04T13:40:26.932558727Z --- app eclient2 logs --- {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.148030][ T1] loop: module loaded", "msgid":"1", "timestamp":"2024-03-04T13:40:06.064139041Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.179240][ T1] lpc_ich 0000:00:1f.0: I/O space for GPIO uninitialized", "msgid":"2", "timestamp":"2024-03-04T13:40:06.095630613Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.180718][ T1] Microchip SmartPQI Driver (v2.1.18-045)", "msgid":"3", "timestamp":"2024-03-04T13:40:06.096727273Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.181597][ T1] megasas: 07.719.03.00-rc1", "msgid":"4", "timestamp":"2024-03-04T13:40:06.097624842Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.182651][ T1] mpt3sas version 43.100.00.00 loaded", "msgid":"5", "timestamp":"2024-03-04T13:40:06.100155481Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.185691][ T1] VMware PVSCSI driver - version 1.0.7.0-k", "msgid":"6", "timestamp":"2024-03-04T13:40:06.102602099Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.187558][ T1] hv_vmbus: registering driver hv_storvsc", "msgid":"7", "timestamp":"2024-03-04T13:40:06.103728999Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.189659][ T1] ACPI: \\_SB_.GSIA: Enabled at IRQ 16", "msgid":"8", "timestamp":"2024-03-04T13:40:06.106618657Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.196425][ T1] ahci 0000:00:1f.2: AHCI 0001.0000 32 slots 6 ports 1.5 Gbps 0x3f impl SATA mode", "msgid":"9", "timestamp":"2024-03-04T13:40:06.113072914Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.197853][ T1] ahci 0000:00:1f.2: flags: 64bit ncq only ", "msgid":"10", "timestamp":"2024-03-04T13:40:06.114087193Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.205896][ T1] scsi host0: ahci", "msgid":"11", "timestamp":"2024-03-04T13:40:06.123574768Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.209212][ T1] scsi host1: ahci", "msgid":"12", "timestamp":"2024-03-04T13:40:06.125089217Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.210600][ T1] scsi host2: ahci", "msgid":"13", "timestamp":"2024-03-04T13:40:06.126702946Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.212198][ T1] scsi host3: ahci", "msgid":"14", "timestamp":"2024-03-04T13:40:06.128022315Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.213245][ T1] scsi host4: ahci", "msgid":"15", "timestamp":"2024-03-04T13:40:06.129619954Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.215618][ T1] scsi host5: ahci", "msgid":"16", "timestamp":"2024-03-04T13:40:06.132848873Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.217865][ T1] ata1: SATA max UDMA/133 abar m4096@0xfe404000 port 0xfe404100 irq 29", "msgid":"17", "timestamp":"2024-03-04T13:40:06.135008511Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.219888][ T1] ata2: SATA max UDMA/133 abar m4096@0xfe404000 port 0xfe404180 irq 29", "msgid":"18", "timestamp":"2024-03-04T13:40:06.137763170Z"} {"source":"527b1d47-75e4-4330-a797-22520e5b55f4.1.2", "content":"[ 1.222711][ T1] ata3: SATA max UDMA/133 abar m4096@0xfe404000 port 0x

# wait for RUNNING state after reboot
test eden.app.test -test.v -timewait 10m -check-new RUNNING eclient1

Check failure on line 46 in tests/eclient/testdata/ctrl_cert_change.txt

View workflow job for this annotation

GitHub Actions / Execute Eden test workflow / Smoke tests (zfs, true)

[stdout] Docker app's state test === RUN TestAppStatus apps: '[eclient1]' state: 'RUNNING' secs: 600 time: 2024-03-04T13:43:59.352140932Z out: appName eclient1 state changed to UNKNOWN app_test.go:171: ASSERTION FAILED (2024-03-04T13:53:59.353156532Z): expected apps [eclient1] in RUNNING state app_test.go:173: actual eclient1: UNKNOWN app_test.go:175: history of states for eclient1: app_test.go:177: state: no info from controller received in: 2024-03-04T13:43:59.352138597Z app_test.go:177: state: UNKNOWN received in: 2024-03-04T13:43:59.35213996Z --- app eclient1 logs --- {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.019394][ T1] lpc_ich 0000:00:1f.0: I/O space for GPIO uninitialized", "msgid":"1", "timestamp":"2024-03-04T13:42:09.049360058Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.024810][ T1] Microchip SmartPQI Driver (v2.1.18-045)", "msgid":"2", "timestamp":"2024-03-04T13:42:09.053967191Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.027110][ T1] megasas: 07.719.03.00-rc1", "msgid":"3", "timestamp":"2024-03-04T13:42:09.056030242Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.029319][ T1] mpt3sas version 43.100.00.00 loaded", "msgid":"4", "timestamp":"2024-03-04T13:42:09.058182919Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.031374][ T1] VMware PVSCSI driver - version 1.0.7.0-k", "msgid":"5", "timestamp":"2024-03-04T13:42:09.060628145Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.033891][ T1] hv_vmbus: registering driver hv_storvsc", "msgid":"6", "timestamp":"2024-03-04T13:42:09.062733819Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.036706][ T1] ACPI: \\_SB_.GSIA: Enabled at IRQ 16", "msgid":"7", "timestamp":"2024-03-04T13:42:09.065692617Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.049163][ T1] ahci 0000:00:1f.2: AHCI 0001.0000 32 slots 6 ports 1.5 Gbps 0x3f impl SATA mode", "msgid":"8", "timestamp":"2024-03-04T13:42:09.086211611Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.059520][ T1] ahci 0000:00:1f.2: flags: 64bit ncq only ", "msgid":"9", "timestamp":"2024-03-04T13:42:09.088478195Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.074766][ T1] scsi host0: ahci", "msgid":"10", "timestamp":"2024-03-04T13:42:09.103185910Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.076879][ T1] scsi host1: ahci", "msgid":"11", "timestamp":"2024-03-04T13:42:09.105531779Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.079301][ T1] scsi host2: ahci", "msgid":"12", "timestamp":"2024-03-04T13:42:09.107936592Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.081319][ T1] scsi host3: ahci", "msgid":"13", "timestamp":"2024-03-04T13:42:09.109958671Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.083199][ T1] scsi host4: ahci", "msgid":"14", "timestamp":"2024-03-04T13:42:09.111543101Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.084801][ T1] scsi host5: ahci", "msgid":"15", "timestamp":"2024-03-04T13:42:09.113372208Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.086407][ T1] ata1: SATA max UDMA/133 abar m4096@0xfe404000 port 0xfe404100 irq 29", "msgid":"16", "timestamp":"2024-03-04T13:42:09.115318001Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.088344][ T1] ata2: SATA max UDMA/133 abar m4096@0xfe404000 port 0xfe404180 irq 29", "msgid":"17", "timestamp":"2024-03-04T13:42:09.117278626Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.090134][ T1] ata3: SATA max UDMA/133 abar m4096@0xfe404000 port 0xfe404200 irq 29", "msgid":"18", "timestamp":"2024-03-04T13:42:09.119028897Z"} {"source":"3c6499ae-3693-49e0-b466-13c100479b55.1.1", "content":"[ 2.091932][ T1] ata
test eden.app.test -test.v -timewait 10m -check-new RUNNING eclient2

eden pod deploy -n eclient3 --memory=512MB --networks=n1 {{template "eclient_image"}} --metadata={{$userdata}}

# check all apps are RUNNING

test eden.app.test -test.v -timewait 20m RUNNING eclient1
test eden.app.test -test.v -timewait 20m RUNNING eclient2
test eden.app.test -test.v -timewait 20m RUNNING eclient3

# cleanup
eden pod delete eclient1
eden pod delete eclient2
eden pod delete eclient3
eden network delete n1

test eden.app.test -test.v -timewait 10m - eclient1
test eden.app.test -test.v -timewait 10m - eclient2
test eden.app.test -test.v -timewait 10m - eclient3
test eden.network.test -test.v -timewait 10m - n1

-- eden-config.yml --
{{/* Test's config. file */}}
test:
controller: adam://{{EdenConfig "adam.ip"}}:{{EdenConfig "adam.port"}}
eve:
{{EdenConfig "eve.name"}}:
onboard-cert: {{EdenConfigPath "eve.cert"}}
serial: "{{EdenConfig "eve.serial"}}"
model: {{EdenConfig "eve.devmodel"}}

-- check_sign_cert.sh --
EDEN={{EdenConfig "eden.root"}}/{{EdenConfig "eden.bin-dist"}}/{{EdenConfig "eden.eden-bin"}}
$EDEN eve ssh cat /persist/certs/server-signing-cert.pem > /tmp/server-signing-cert.pem
diff -Z /tmp/signing-new.pem /tmp/server-signing-cert.pem
10 changes: 6 additions & 4 deletions tests/workflow/smoke.tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Number of tests
{{$tests := 22}}
{{$tests := 23}}
# EDEN_TEST_SETUP env. var. -- "y"(default) performs the EDEN setup steps
{{$setup := "y"}}
{{$setup_env := EdenGetEnv "EDEN_TEST_SETUP"}}
Expand Down Expand Up @@ -70,12 +70,14 @@ eden.escript.test -testdata ../eclient/testdata/ -test.run TestEdenScripts/metad
eden.escript.test -testdata ../eclient/testdata/ -test.run TestEdenScripts/userdata
/bin/echo Eden app log test (19/{{$tests}})
eden.escript.test -testdata ../eclient/testdata/ -test.run TestEdenScripts/app_logs
/bin/echo Eden change controller certificate test (20/{{$tests}})
eden.escript.test -testdata ../eclient/testdata/ -test.run TestEdenScripts/ctrl_cert_change

/bin/echo Eden Shutdown test (20/{{$tests}})
/bin/echo Eden Shutdown test (21/{{$tests}})
eden.escript.test -testdata ../eclient/testdata/ -test.run TestEdenScripts/shutdown_test

/bin/echo EVE reset (21/{{$tests}})
/bin/echo EVE reset (22/{{$tests}})
eden.escript.test -test.run TestEdenScripts/eden_reset

/bin/echo EVE security tests (22/{{$tests}})
/bin/echo EVE security tests (23/{{$tests}})
eden.escript.test -test.run TestEdenScripts/sec_eden

0 comments on commit 9440875

Please sign in to comment.