@@ -34,6 +34,18 @@ import (
3434 "github.com/stretchr/testify/require"
3535)
3636
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+
3749// TestGetAppInstallStatus tests the GET /linux/install/app/status endpoint
3850func TestGetAppInstallStatus (t * testing.T ) {
3951 // Create mock helm chart archive
@@ -44,9 +56,11 @@ func TestGetAppInstallStatus(t *testing.T) {
4456 HelmChartArchives : [][]byte {mockChartArchive },
4557 EmbeddedClusterConfig : & ecv1beta1.Config {},
4658 ChannelRelease : & release.ChannelRelease {
59+ AppSlug : "test-app" ,
4760 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" ,
5064 },
5165 },
5266 AppConfig : & kotsv1beta1.Config {},
@@ -109,6 +123,7 @@ func TestGetAppInstallStatus(t *testing.T) {
109123 linuxinstall .WithAppInstallController (appInstallController ),
110124 linuxinstall .WithReleaseData (releaseData ),
111125 linuxinstall .WithRuntimeConfig (runtimeconfig .New (nil )),
126+ linuxinstall .WithLicense (mockLicense ()),
112127 )
113128 require .NoError (t , err )
114129
@@ -165,6 +180,7 @@ func TestGetAppInstallStatus(t *testing.T) {
165180 // Create simple Linux install controller
166181 installController , err := linuxinstall .NewInstallController (
167182 linuxinstall .WithReleaseData (releaseData ),
183+ linuxinstall .WithLicense (mockLicense ()),
168184 )
169185 require .NoError (t , err )
170186
@@ -228,9 +244,11 @@ func TestPostInstallApp(t *testing.T) {
228244 releaseData := & release.ReleaseData {
229245 EmbeddedClusterConfig : & ecv1beta1.Config {},
230246 ChannelRelease : & release.ChannelRelease {
247+ AppSlug : "test-app" ,
231248 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" ,
234252 },
235253 },
236254 AppConfig : & kotsv1beta1.Config {},
@@ -320,6 +338,7 @@ func TestPostInstallApp(t *testing.T) {
320338 linuxinstall .WithMetricsReporter (mockReporter ),
321339 linuxinstall .WithReleaseData (releaseData ),
322340 linuxinstall .WithRuntimeConfig (rc ),
341+ linuxinstall .WithLicense (mockLicense ()),
323342 )
324343 require .NoError (t , err )
325344
@@ -391,6 +410,7 @@ func TestPostInstallApp(t *testing.T) {
391410 linuxinstall .WithStateMachine (stateMachine ),
392411 linuxinstall .WithAppInstallController (appInstallController ),
393412 linuxinstall .WithReleaseData (releaseData ),
413+ linuxinstall .WithLicense (mockLicense ()),
394414 )
395415 require .NoError (t , err )
396416
@@ -479,6 +499,7 @@ func TestPostInstallApp(t *testing.T) {
479499 linuxinstall .WithStore (mockStore ),
480500 linuxinstall .WithReleaseData (releaseData ),
481501 linuxinstall .WithRuntimeConfig (rc ),
502+ linuxinstall .WithLicense (mockLicense ()),
482503 )
483504 require .NoError (t , err )
484505
@@ -532,6 +553,7 @@ func TestPostInstallApp(t *testing.T) {
532553 // Create simple Linux install controller
533554 installController , err := linuxinstall .NewInstallController (
534555 linuxinstall .WithReleaseData (releaseData ),
556+ linuxinstall .WithLicense (mockLicense ()),
535557 )
536558 require .NoError (t , err )
537559
@@ -607,6 +629,7 @@ func TestPostInstallApp(t *testing.T) {
607629 linuxinstall .WithStateMachine (stateMachine ),
608630 linuxinstall .WithAppInstallController (appInstallController ),
609631 linuxinstall .WithReleaseData (releaseData ),
632+ linuxinstall .WithLicense (mockLicense ()),
610633 )
611634 require .NoError (t , err )
612635
@@ -684,6 +707,7 @@ func TestPostInstallApp(t *testing.T) {
684707 linuxinstall .WithStateMachine (stateMachine ),
685708 linuxinstall .WithAppInstallController (appInstallController ),
686709 linuxinstall .WithReleaseData (releaseData ),
710+ linuxinstall .WithLicense (mockLicense ()),
687711 )
688712 require .NoError (t , err )
689713
0 commit comments