@@ -34,6 +34,18 @@ import (
34
34
"github.com/stretchr/testify/require"
35
35
)
36
36
37
+ // mockLicense creates a mock license for testing
38
+ func mockLicense () []byte {
39
+ return []byte (`
40
+ apiVersion: kots.io/v1beta1
41
+ kind: License
42
+ spec:
43
+ licenseID: "test-license-id-12345"
44
+ appSlug: "test-app"
45
+ customerName: "Test Customer"
46
+ ` )
47
+ }
48
+
37
49
// TestGetAppInstallStatus tests the GET /linux/install/app/status endpoint
38
50
func TestGetAppInstallStatus (t * testing.T ) {
39
51
// Create mock helm chart archive
@@ -44,9 +56,11 @@ func TestGetAppInstallStatus(t *testing.T) {
44
56
HelmChartArchives : [][]byte {mockChartArchive },
45
57
EmbeddedClusterConfig : & ecv1beta1.Config {},
46
58
ChannelRelease : & release.ChannelRelease {
59
+ AppSlug : "test-app" ,
47
60
DefaultDomains : release.Domains {
48
- ReplicatedAppDomain : "replicated.example.com" ,
49
- ProxyRegistryDomain : "some-proxy.example.com" ,
61
+ ReplicatedAppDomain : "replicated.example.com" ,
62
+ ProxyRegistryDomain : "some-proxy.example.com" ,
63
+ ReplicatedRegistryDomain : "registry.example.com" ,
50
64
},
51
65
},
52
66
AppConfig : & kotsv1beta1.Config {},
@@ -109,6 +123,7 @@ func TestGetAppInstallStatus(t *testing.T) {
109
123
linuxinstall .WithAppInstallController (appInstallController ),
110
124
linuxinstall .WithReleaseData (releaseData ),
111
125
linuxinstall .WithRuntimeConfig (runtimeconfig .New (nil )),
126
+ linuxinstall .WithLicense (mockLicense ()),
112
127
)
113
128
require .NoError (t , err )
114
129
@@ -165,6 +180,7 @@ func TestGetAppInstallStatus(t *testing.T) {
165
180
// Create simple Linux install controller
166
181
installController , err := linuxinstall .NewInstallController (
167
182
linuxinstall .WithReleaseData (releaseData ),
183
+ linuxinstall .WithLicense (mockLicense ()),
168
184
)
169
185
require .NoError (t , err )
170
186
@@ -228,9 +244,11 @@ func TestPostInstallApp(t *testing.T) {
228
244
releaseData := & release.ReleaseData {
229
245
EmbeddedClusterConfig : & ecv1beta1.Config {},
230
246
ChannelRelease : & release.ChannelRelease {
247
+ AppSlug : "test-app" ,
231
248
DefaultDomains : release.Domains {
232
- ReplicatedAppDomain : "replicated.example.com" ,
233
- ProxyRegistryDomain : "some-proxy.example.com" ,
249
+ ReplicatedAppDomain : "replicated.example.com" ,
250
+ ProxyRegistryDomain : "some-proxy.example.com" ,
251
+ ReplicatedRegistryDomain : "registry.example.com" ,
234
252
},
235
253
},
236
254
AppConfig : & kotsv1beta1.Config {},
@@ -320,6 +338,7 @@ func TestPostInstallApp(t *testing.T) {
320
338
linuxinstall .WithMetricsReporter (mockReporter ),
321
339
linuxinstall .WithReleaseData (releaseData ),
322
340
linuxinstall .WithRuntimeConfig (rc ),
341
+ linuxinstall .WithLicense (mockLicense ()),
323
342
)
324
343
require .NoError (t , err )
325
344
@@ -391,6 +410,7 @@ func TestPostInstallApp(t *testing.T) {
391
410
linuxinstall .WithStateMachine (stateMachine ),
392
411
linuxinstall .WithAppInstallController (appInstallController ),
393
412
linuxinstall .WithReleaseData (releaseData ),
413
+ linuxinstall .WithLicense (mockLicense ()),
394
414
)
395
415
require .NoError (t , err )
396
416
@@ -479,6 +499,7 @@ func TestPostInstallApp(t *testing.T) {
479
499
linuxinstall .WithStore (mockStore ),
480
500
linuxinstall .WithReleaseData (releaseData ),
481
501
linuxinstall .WithRuntimeConfig (rc ),
502
+ linuxinstall .WithLicense (mockLicense ()),
482
503
)
483
504
require .NoError (t , err )
484
505
@@ -532,6 +553,7 @@ func TestPostInstallApp(t *testing.T) {
532
553
// Create simple Linux install controller
533
554
installController , err := linuxinstall .NewInstallController (
534
555
linuxinstall .WithReleaseData (releaseData ),
556
+ linuxinstall .WithLicense (mockLicense ()),
535
557
)
536
558
require .NoError (t , err )
537
559
@@ -607,6 +629,7 @@ func TestPostInstallApp(t *testing.T) {
607
629
linuxinstall .WithStateMachine (stateMachine ),
608
630
linuxinstall .WithAppInstallController (appInstallController ),
609
631
linuxinstall .WithReleaseData (releaseData ),
632
+ linuxinstall .WithLicense (mockLicense ()),
610
633
)
611
634
require .NoError (t , err )
612
635
@@ -684,6 +707,7 @@ func TestPostInstallApp(t *testing.T) {
684
707
linuxinstall .WithStateMachine (stateMachine ),
685
708
linuxinstall .WithAppInstallController (appInstallController ),
686
709
linuxinstall .WithReleaseData (releaseData ),
710
+ linuxinstall .WithLicense (mockLicense ()),
687
711
)
688
712
require .NoError (t , err )
689
713
0 commit comments