@@ -51,9 +51,9 @@ func TestCiliumAccelerationMigration_Applies(t *testing.T) {
5151}
5252
5353func TestCiliumAccelerationMigration_Execute (t * testing.T ) {
54- origK8s , origState , origReconfigure , origShell := kubernetesInstalled , readCiliumState , reconfigureCiliumConfig , runShell
54+ origK8s , origState , origReconfigure , origShell , origVerify := kubernetesInstalled , readCiliumState , reconfigureCiliumConfig , runShell , verifyCiliumExecutable
5555 t .Cleanup (func () {
56- kubernetesInstalled , readCiliumState , reconfigureCiliumConfig , runShell = origK8s , origState , origReconfigure , origShell
56+ kubernetesInstalled , readCiliumState , reconfigureCiliumConfig , runShell , verifyCiliumExecutable = origK8s , origState , origReconfigure , origShell , origVerify
5757 })
5858
5959 m := NewCiliumAccelerationMigration ()
@@ -84,8 +84,9 @@ func TestCiliumAccelerationMigration_Execute(t *testing.T) {
8484 assert .False (t , ran , "must not run before Kubernetes is installed" )
8585 })
8686
87- // Remaining cases assume Kubernetes is present.
87+ // Remaining cases assume Kubernetes is present and cilium verification passes .
8888 kubernetesInstalled = func () bool { return true }
89+ verifyCiliumExecutable = func () error { return nil }
8990
9091 t .Run ("skips when Cilium is not installed" , func (t * testing.T ) {
9192 var ran bool
@@ -128,4 +129,19 @@ func TestCiliumAccelerationMigration_Execute(t *testing.T) {
128129 assert .Contains (t , cmd , "--values" )
129130 assert .Contains (t , cmd , "--wait" )
130131 })
132+
133+ t .Run ("aborts before upgrade when the cilium binary fails verification" , func (t * testing.T ) {
134+ var ran bool
135+ var cmd string
136+ stateReturns (true , "best-effort" , nil )
137+ reconfigureCiliumConfig = func () (string , error ) {
138+ return "/opt/solo/weaver/sandbox/etc/weaver/cilium-config.yaml" , nil
139+ }
140+ trackUpgrade (& cmd , & ran )
141+ verifyCiliumExecutable = func () error { return assert .AnError }
142+ t .Cleanup (func () { verifyCiliumExecutable = func () error { return nil } })
143+
144+ require .Error (t , m .Execute (context .Background (), mctx ))
145+ assert .False (t , ran , "cilium upgrade must not run when the binary fails checksum verification" )
146+ })
131147}
0 commit comments