11package com.cloudogu.gitops
22
33import com.cloudogu.gitops.config.Config
4+ import com.cloudogu.gitops.features.git.config.ScmTenantSchema
45import io.micronaut.context.ApplicationContext
56import org.junit.jupiter.api.Test
67
@@ -24,6 +25,9 @@ class ApplicationTest {
2425 void ' get active namespaces correctly' () {
2526 config. registry. active = true
2627 config. jenkins. active = true
28+ config. jenkins. internal = true
29+ config. scm. scmManager = new ScmTenantSchema.ScmManagerTenantConfig ()
30+ config. scm. scmManager. internal = true
2731 config. features. monitoring. active = true
2832 config. features. argocd. active = true
2933 config. content. examples = true
@@ -54,6 +58,9 @@ class ApplicationTest {
5458 void ' get active namespaces correctly in Openshift' () {
5559 config. registry. active = true
5660 config. jenkins. active = true
61+ config. jenkins. internal = true
62+ config. scm. scmManager = new ScmTenantSchema.ScmManagerTenantConfig ()
63+ config. scm. scmManager. internal = true
5764 config. features. monitoring. active = true
5865 config. features. argocd. active = true
5966 config. content. examples = true
@@ -81,6 +88,38 @@ class ApplicationTest {
8188 assertThat (config. application. namespaces. getActiveNamespaces()). containsExactlyInAnyOrderElementsOf(namespaceList)
8289 }
8390
91+ @Test
92+ void ' get active namespaces correctly in Openshift if jenkins and scm are external' () {
93+ config. registry. active = true
94+ config. jenkins. active = true
95+ config. jenkins. internal = false
96+ config. scm. scmManager = new ScmTenantSchema.ScmManagerTenantConfig ()
97+ config. scm. scmManager. internal = false
98+ config. features. monitoring. active = true
99+ config. features. argocd. active = true
100+ config. content. examples = true
101+ config. features. ingressNginx. active = true
102+ config. application. namePrefix = ' test1-'
103+ config. application. openshift = true
104+ config. content. namespaces = [
105+ ' ${config.application.namePrefix}example-apps-staging' ,
106+ ' ${config.application.namePrefix}example-apps-production'
107+ ]
108+ List<String > namespaceList = new ArrayList<> (Arrays . asList(
109+ " test1-argocd" ,
110+ " test1-example-apps-staging" ,
111+ " test1-example-apps-production" ,
112+ " test1-ingress-nginx" ,
113+ " test1-monitoring" ,
114+ " test1-registry" ,
115+ ))
116+ def application = ApplicationContext . run()
117+ .registerSingleton(config)
118+ .getBean(Application )
119+ application. setNamespaceListToConfig(config)
120+ assertThat (config. application. namespaces. getActiveNamespaces()). containsExactlyInAnyOrderElementsOf(namespaceList)
121+ }
122+
84123 @Test
85124 void ' handles content namespaces without template' () {
86125 config. content. namespaces = [
0 commit comments