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
@@ -103,4 +104,35 @@ class ApplicationTest {
103104 application. setNamespaceListToConfig(config)
104105 // No exception == happy
105106 }
107+ @Test
108+ void ' get active namespaces correctly in Openshift if jenkins and scm are external' () {
109+ config. registry. active = true
110+ config. jenkins. active = true
111+ config. jenkins. internal = false
112+ config. scm. scmManager = new ScmTenantSchema.ScmManagerTenantConfig ()
113+ config. scm. scmManager. internal = false
114+ config. features. monitoring. active = true
115+ config. features. argocd. active = true
116+ config. content. examples = true
117+ config. features. ingressNginx. active = true
118+ config. application. namePrefix = ' test1-'
119+ config. application. openshift = true
120+ config. content. namespaces = [
121+ ' ${config.application.namePrefix}example-apps-staging' ,
122+ ' ${config.application.namePrefix}example-apps-production'
123+ ]
124+ List<String > namespaceList = new ArrayList<> (Arrays . asList(
125+ " test1-argocd" ,
126+ " test1-example-apps-staging" ,
127+ " test1-example-apps-production" ,
128+ " test1-ingress-nginx" ,
129+ " test1-monitoring" ,
130+ " test1-registry" ,
131+ ))
132+ def application = ApplicationContext . run()
133+ .registerSingleton(config)
134+ .getBean(Application )
135+ application. setNamespaceListToConfig(config)
136+ assertThat (config. application. namespaces. getActiveNamespaces()). containsExactlyInAnyOrderElementsOf(namespaceList)
137+ }
106138}
0 commit comments