Skip to content

Commit 1bae380

Browse files
committed
Scripts for database creation on test. postgresql population fails
1 parent 5c2ef0f commit 1bae380

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

test/scripts/createMongoDB.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
oc new-app -n ${YAKS_NAMESPACE} --name="mongodb" --template=mongodb-persistent \
4+
-e MONGODB_USER=camel-k-example -e MONGODB_PASSWORD=transformations \
5+
-e MONGODB_DATABASE=example -e MONGODB_ADMIN_PASSWORD=compleexpasswrd

test/scripts/createPostgreSQL.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
oc new-app -n ${YAKS_NAMESPACE} --name="postgres" --template=postgresql-ephemeral \
4+
-e POSTGRESQL_USER=camel-k-example \
5+
-e POSTGRESQL_PASSWORD=transformations \
6+
-e POSTGRESQL_DATABASE=example
7+
8+
# wait for the postgres pod to be created
9+
export PGPOD=""
10+
11+
while [[ -z $PGPOD ]]
12+
do
13+
sleep 2
14+
export PGPOD=$(oc get pods -n ${YAKS_NAMESPACE} -o custom-columns=POD:.metadata.name --no-headers | \
15+
grep postgresql | grep -v deploy)
16+
done
17+
18+
# ensure postgresql pod is deployed and Ready
19+
oc wait pod $PGPOD -n ${YAKS_NAMESPACE} --for condition=Ready
20+
21+
# populate database with dummy data
22+
oc rsh -n ${YAKS_NAMESPACE} $PGPOD \
23+
psql -U camel-k-example example \
24+
-c "CREATE TABLE descriptions (id varchar(10), info varchar(30));INSERT INTO descriptions (id, info) VALUES ('SO2', 'Nitric oxide is a free radical');INSERT INTO descriptions (id, info) VALUES ('NO2', 'Toxic gas');"

test/yaks-config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ config:
22
namespace:
33
temporary: true
44
pre:
5+
- name: Create MongoDB
6+
script: scripts/createMongoDB.sh
7+
- name: Create PostgreSQL
8+
script: scripts/createPostgreSQL.sh
59
- name: integrations
610
run: |
11+
cd ..
712
kamel install -w -n ${YAKS_NAMESPACE}
8-
kamel run ../Transformations.java -n ${YAKS_NAMESPACE}
13+
kamel run Transformations.java -n ${YAKS_NAMESPACE}

0 commit comments

Comments
 (0)