@@ -257,7 +257,11 @@ func TestAppInstallManager_Install(t *testing.T) {
257
257
return opts .ChartPath != "" && opts .ReleaseName == "fluentd" && opts .Namespace == "logging"
258
258
})).Return ((* helmrelease .Release )(nil ), assert .AnError )
259
259
260
- // Create manager with initialized store (no need for KOTS installer mock since Helm fails first)
260
+ // Create mock installer that succeeds (so we get to Helm charts)
261
+ mockInstaller := & MockKotsCLIInstaller {}
262
+ mockInstaller .On ("Install" , mock .Anything ).Return (nil )
263
+
264
+ // Create manager with initialized store
261
265
store := appinstallstore .NewMemoryStore (appinstallstore .WithAppInstall (types.AppInstall {
262
266
Status : types.Status {State : types .StatePending },
263
267
}))
@@ -266,6 +270,7 @@ func TestAppInstallManager_Install(t *testing.T) {
266
270
WithClusterID ("test-cluster" ),
267
271
WithReleaseData (releaseData ),
268
272
WithK8sVersion ("v1.33.0" ),
273
+ WithKotsCLI (mockInstaller ),
269
274
WithHelmClient (mockHelmClient ),
270
275
WithLogger (logger .NewDiscardLogger ()),
271
276
WithAppInstallStore (store ),
@@ -282,6 +287,7 @@ func TestAppInstallManager_Install(t *testing.T) {
282
287
assert .Equal (t , types .StateFailed , appInstall .Status .State )
283
288
assert .Contains (t , appInstall .Status .Description , "install helm charts" )
284
289
290
+ mockInstaller .AssertExpectations (t )
285
291
mockHelmClient .AssertExpectations (t )
286
292
})
287
293
@@ -491,6 +497,10 @@ func TestComponentStatusTracking(t *testing.T) {
491
497
return opts .ReleaseName == "failing-app"
492
498
})).Return ((* helmrelease .Release )(nil ), errors .New ("helm install failed" ))
493
499
500
+ // Create mock installer that succeeds (so we get to Helm charts)
501
+ mockInstaller := & MockKotsCLIInstaller {}
502
+ mockInstaller .On ("Install" , mock .Anything ).Return (nil )
503
+
494
504
// Create manager with in-memory store
495
505
appInstallStore := appinstallstore .NewMemoryStore (appinstallstore .WithAppInstall (types.AppInstall {
496
506
Status : types.Status {State : types .StatePending },
@@ -501,6 +511,7 @@ func TestComponentStatusTracking(t *testing.T) {
501
511
WithK8sVersion ("v1.33.0" ),
502
512
WithLicense ([]byte (`{"spec":{"appSlug":"test-app"}}` )),
503
513
WithClusterID ("test-cluster" ),
514
+ WithKotsCLI (mockInstaller ),
504
515
WithHelmClient (mockHelmClient ),
505
516
)
506
517
require .NoError (t , err )
@@ -525,6 +536,7 @@ func TestComponentStatusTracking(t *testing.T) {
525
536
// Overall status should be failed
526
537
assert .Equal (t , types .StateFailed , appInstall .Status .State )
527
538
539
+ mockInstaller .AssertExpectations (t )
528
540
mockHelmClient .AssertExpectations (t )
529
541
})
530
542
}
0 commit comments