@@ -62,9 +62,13 @@ class IBMPythonActionDB2Tests extends TestHelpers with WskTestHelpers with Befor
6262 Other exit codes are acceptable, for example 2 means that there was no active databases
6363 exitCode 4 = SQL1032N No start database manager command was issued.
6464 exitCode 2 = SQL1611W No data was returned by Database System Monitor.
65+ exitCode 8 = SQL10007N Message "-1390" could not be retrieved. Reason code: "3".
66+ exitCode 126 = stat /database/config/db2inst1/sqllib/bin/db2: no such file or directory.
67+ exitCode 127 = /database/config/db2inst1/sqllib/bin/db2: No such file or directory.
68+
6569 */
6670 def sleepUntilContainerRunning () {
67- var counter = 5 ;
71+ var counter = 48 ; // 48*5s=240s -> 4 minutes
6872 var running = false ;
6973 do {
7074 counter = counter - 1
@@ -78,12 +82,11 @@ class IBMPythonActionDB2Tests extends TestHelpers with WskTestHelpers with Befor
7882 " --user" ,
7983 " db2inst1" ,
8084 db2containerName,
81- " /home/db2inst1/sqllib/bin/db2" ,
82- " list" ,
83- " active" ,
84- " databases" )
85+ " bash" ,
86+ " -c" ,
87+ " . /database/config/db2inst1/.bashrc && db2 list active databases" )
8588
86- if (isdb2Running.exitCode == 4 ) {
89+ if (( isdb2Running.exitCode != 0 ) && (isdb2Running.exitCode != 2 ) ) {
8790 Thread .sleep(5000 )
8891 } else {
8992 running = true ;
@@ -105,13 +108,15 @@ class IBMPythonActionDB2Tests extends TestHelpers with WskTestHelpers with Befor
105108 " -p" ,
106109 " 50000:50000" ,
107110 " -e" ,
111+ " DB2INSTANCE=db2inst1" ,
112+ " -e" ,
108113 " DB2INST1_PASSWORD=db2inst1-pwd" ,
109114 " -e" ,
110115 " LICENSE=accept" ,
116+ " --privileged=true" ,
111117 " --name" ,
112118 db2containerName,
113- " ibmcom/db2express-c" ,
114- " db2start" )
119+ " ibmcom/db2" )
115120
116121 sleepUntilContainerRunning()
117122
@@ -122,7 +127,7 @@ class IBMPythonActionDB2Tests extends TestHelpers with WskTestHelpers with Befor
122127 " docker" ,
123128 " cp" ,
124129 db2dir + " setup.sql" ,
125- db2containerName + " :/home /db2inst1/setup.sql" )
130+ db2containerName + " :/database/config /db2inst1/setup.sql" )
126131 println(" Creating db2 database, might take up to 5 minutes" )
127132 TestUtils .runCmd(
128133 0 ,
@@ -133,9 +138,9 @@ class IBMPythonActionDB2Tests extends TestHelpers with WskTestHelpers with Befor
133138 " --user" ,
134139 " db2inst1" ,
135140 db2containerName,
136- " /home/db2inst1/sqllib/bin/db2 " ,
137- " -tvf " ,
138- " /home /db2inst1/setup.sql" )
141+ " bash " ,
142+ " -c " ,
143+ " . /database/config/db2inst1/.bashrc && db2 -tvf /database/config /db2inst1/setup.sql" )
139144 }
140145
141146 override def afterAll () {
0 commit comments