@@ -32,6 +32,21 @@ func Test_BundleToHelmChartConverter_ToHelmChart_ReturnsBundleSourceFailures(t *
3232 require .Contains (t , err .Error (), "some error" )
3333}
3434
35+ func Test_BundleToHelmChartConverter_ToHelmChart_ReturnsBundleConfigFailures (t * testing.T ) {
36+ converter := convert.BundleToHelmChartConverter {}
37+ b := source .FromBundle (
38+ bundle.RegistryV1 {
39+ CSV : MakeCSV (WithInstallModeSupportFor (v1alpha1 .InstallModeTypeAllNamespaces )),
40+ },
41+ )
42+ config := map [string ]interface {}{
43+ bundle .BundleConfigWatchNamespaceKey : "some-namespace" ,
44+ }
45+ _ , err := converter .ToHelmChart (b , "install-namespace" , config )
46+ require .Error (t , err )
47+ require .Contains (t , err .Error (), "'watchNamespace' not allowed" )
48+ }
49+
3550func Test_BundleToHelmChartConverter_ToHelmChart_ReturnsBundleRendererFailures (t * testing.T ) {
3651 converter := convert.BundleToHelmChartConverter {
3752 BundleRenderer : render.BundleRenderer {
@@ -45,12 +60,12 @@ func Test_BundleToHelmChartConverter_ToHelmChart_ReturnsBundleRendererFailures(t
4560
4661 b := source .FromBundle (
4762 bundle.RegistryV1 {
48- CSV : MakeCSV (WithInstallModeSupportFor (v1alpha1 .InstallModeTypeAllNamespaces )),
63+ CSV : MakeCSV (WithInstallModeSupportFor (v1alpha1 .InstallModeTypeSingleNamespace )),
4964 },
5065 )
5166
5267 config := map [string ]interface {}{
53- bundle .BundleConfigWatchNamespaceKey : "" ,
68+ bundle .BundleConfigWatchNamespaceKey : "some-namespace " ,
5469 }
5570 _ , err := converter .ToHelmChart (b , "install-namespace" , config )
5671 require .Error (t , err )
@@ -121,22 +136,22 @@ func Test_BundleToHelmChartConverter_ToHelmChart_WebhooksWithCertProvider(t *tes
121136 b := source .FromBundle (
122137 bundle.RegistryV1 {
123138 CSV : MakeCSV (
124- WithInstallModeSupportFor (v1alpha1 .InstallModeTypeAllNamespaces ),
139+ WithInstallModeSupportFor (v1alpha1 .InstallModeTypeSingleNamespace ),
125140 WithWebhookDefinitions (v1alpha1.WebhookDescription {}),
126141 ),
127142 },
128143 )
129144
130145 config := map [string ]interface {}{
131- bundle .BundleConfigWatchNamespaceKey : "" ,
146+ bundle .BundleConfigWatchNamespaceKey : "some-namespace " ,
132147 }
133148 _ , err := converter .ToHelmChart (b , "install-namespace" , config )
134149 require .NoError (t , err )
135150}
136151
137152func Test_BundleToHelmChartConverter_ToHelmChart_BundleRendererIntegration (t * testing.T ) {
138153 expectedInstallNamespace := "install-namespace"
139- expectedWatchNamespace := ""
154+ expectedWatchNamespace := "some-namespaces "
140155 expectedCertProvider := FakeCertProvider {}
141156
142157 converter := convert.BundleToHelmChartConverter {
@@ -156,7 +171,7 @@ func Test_BundleToHelmChartConverter_ToHelmChart_BundleRendererIntegration(t *te
156171
157172 b := source .FromBundle (
158173 bundle.RegistryV1 {
159- CSV : MakeCSV (WithInstallModeSupportFor (v1alpha1 .InstallModeTypeAllNamespaces )),
174+ CSV : MakeCSV (WithInstallModeSupportFor (v1alpha1 .InstallModeTypeSingleNamespace )),
160175 },
161176 )
162177
@@ -186,7 +201,7 @@ func Test_BundleToHelmChartConverter_ToHelmChart_Success(t *testing.T) {
186201 bundle.RegistryV1 {
187202 CSV : MakeCSV (
188203 WithAnnotations (map [string ]string {"foo" : "bar" }),
189- WithInstallModeSupportFor (v1alpha1 .InstallModeTypeAllNamespaces ),
204+ WithInstallModeSupportFor (v1alpha1 .InstallModeTypeAllNamespaces , v1alpha1 . InstallModeTypeSingleNamespace ),
190205 ),
191206 Others : []unstructured.Unstructured {
192207 * ToUnstructuredT (t , & corev1.Service {
@@ -203,7 +218,7 @@ func Test_BundleToHelmChartConverter_ToHelmChart_Success(t *testing.T) {
203218 )
204219
205220 config := map [string ]interface {}{
206- bundle .BundleConfigWatchNamespaceKey : "" ,
221+ bundle .BundleConfigWatchNamespaceKey : "some-namespace " ,
207222 }
208223 chart , err := converter .ToHelmChart (b , "install-namespace" , config )
209224 require .NoError (t , err )
0 commit comments