@@ -34,7 +34,7 @@ describe('databases', () => {
3434 expect ( postgresDataflowDeployment ) . toBeTruthy ( ) ;
3535 const postgresDataflowContainer = deploymentContainer ( postgresDataflowDeployment , DB_POSTGRES_NAME ) ;
3636 expect ( postgresDataflowContainer ?. image ) . toBe ( 'postgres:10' ) ;
37- const postgresDataflowSecret = findSecret ( yaml , DB_SKIPPER_NAME ) ;
37+ const postgresDataflowSecret = findSecret ( yaml , DB_DATAFLOW_NAME ) ;
3838 expect ( postgresDataflowSecret ) . toBeTruthy ( ) ;
3939 const postgresDataflowSecretData = postgresDataflowSecret ?. data || { } ;
4040 expect ( postgresDataflowSecretData [ 'postgres-user' ] ) . toBe ( 'ZGF0YWZsb3c=' ) ;
@@ -134,7 +134,7 @@ describe('databases', () => {
134134 expect ( postgresDataflowDeployment ) . toBeTruthy ( ) ;
135135 const postgresDataflowContainer = deploymentContainer ( postgresDataflowDeployment , DB_POSTGRES_NAME ) ;
136136 expect ( postgresDataflowContainer ?. image ) . toContain ( 'postgres' ) ;
137- const postgresDataflowSecret = findSecret ( yaml , DB_SKIPPER_NAME ) ;
137+ const postgresDataflowSecret = findSecret ( yaml , DB_DATAFLOW_NAME ) ;
138138 expect ( postgresDataflowSecret ) . toBeTruthy ( ) ;
139139 const postgresDataflowSecretData = postgresDataflowSecret ?. data || { } ;
140140 expect ( postgresDataflowSecretData [ 'postgres-user' ] ) . toBe ( 'ZGF0YWZsb3c=' ) ;
@@ -202,7 +202,7 @@ describe('databases', () => {
202202 expect ( postgresDataflowDeployment ) . toBeTruthy ( ) ;
203203 const postgresDataflowContainer = deploymentContainer ( postgresDataflowDeployment , DB_POSTGRES_NAME ) ;
204204 expect ( postgresDataflowContainer ?. image ) . toContain ( 'postgres' ) ;
205- const postgresDataflowSecret = findSecret ( yaml , DB_SKIPPER_NAME ) ;
205+ const postgresDataflowSecret = findSecret ( yaml , DB_DATAFLOW_NAME ) ;
206206 expect ( postgresDataflowSecret ) . toBeTruthy ( ) ;
207207 const postgresDataflowSecretData = postgresDataflowSecret ?. data || { } ;
208208 expect ( postgresDataflowSecretData [ 'postgres-user' ] ) . toBe ( 'user' ) ;
@@ -216,7 +216,11 @@ describe('databases', () => {
216216 ...DEFAULT_REQUIRED_DATA_VALUES ,
217217 'scdf.deploy.database.enabled=false' ,
218218 'scdf.server.database.url=fakeurl1' ,
219- 'scdf.skipper.database.url=fakeurl2'
219+ 'scdf.server.database.username=fakeuser1' ,
220+ 'scdf.server.database.password=fakepass1' ,
221+ 'scdf.skipper.database.url=fakeurl2' ,
222+ 'scdf.skipper.database.username=fakeuser2' ,
223+ 'scdf.skipper.database.password=fakepass2'
220224 ]
221225 } ) ;
222226 expect ( result . success , result . stderr ) . toBeTruthy ( ) ;
@@ -237,10 +241,30 @@ describe('databases', () => {
237241 const dataflowJson = dataflowDoc . toJSON ( ) ;
238242 const dataflowDatasourceUrl = lodash . get ( dataflowJson , 'spring.datasource.url' ) as string ;
239243 expect ( dataflowDatasourceUrl ) . toBe ( 'fakeurl1' ) ;
244+ const dataflowDatasourceUsername = lodash . get ( dataflowJson , 'spring.datasource.username' ) as string ;
245+ expect ( dataflowDatasourceUsername ) . toBe ( '${external-user}' ) ;
246+ const dataflowDatasourcePassword = lodash . get ( dataflowJson , 'spring.datasource.password' ) as string ;
247+ expect ( dataflowDatasourcePassword ) . toBe ( '${external-password}' ) ;
248+
249+ const postgresDataflowSecret = findSecret ( yaml , DB_DATAFLOW_NAME ) ;
250+ expect ( postgresDataflowSecret ) . toBeTruthy ( ) ;
251+ const postgresDataflowSecretData = postgresDataflowSecret ?. data || { } ;
252+ expect ( postgresDataflowSecretData [ 'external-user' ] ) . toBe ( 'ZmFrZXVzZXIx' ) ;
253+ expect ( postgresDataflowSecretData [ 'external-password' ] ) . toBe ( 'ZmFrZXBhc3Mx' ) ;
240254
241255 const skipperDoc = parseYamlDocument ( skipperApplicationYaml ) ;
242256 const skipperJson = skipperDoc . toJSON ( ) ;
243257 const skipperDatasourceUrl = lodash . get ( skipperJson , 'spring.datasource.url' ) as string ;
244258 expect ( skipperDatasourceUrl ) . toBe ( 'fakeurl2' ) ;
259+ const skipperDatasourceUsername = lodash . get ( skipperJson , 'spring.datasource.username' ) as string ;
260+ expect ( skipperDatasourceUsername ) . toBe ( '${external-user}' ) ;
261+ const skipperDatasourcePassword = lodash . get ( skipperJson , 'spring.datasource.password' ) as string ;
262+ expect ( skipperDatasourcePassword ) . toBe ( '${external-password}' ) ;
263+
264+ const postgresSkipperSecret = findSecret ( yaml , DB_SKIPPER_NAME ) ;
265+ expect ( postgresSkipperSecret ) . toBeTruthy ( ) ;
266+ const postgresSkipperSecretData = postgresSkipperSecret ?. data || { } ;
267+ expect ( postgresSkipperSecretData [ 'external-user' ] ) . toBe ( 'ZmFrZXVzZXIy' ) ;
268+ expect ( postgresSkipperSecretData [ 'external-password' ] ) . toBe ( 'ZmFrZXBhc3My' ) ;
245269 } ) ;
246270} ) ;
0 commit comments