File tree Expand file tree Collapse file tree 2 files changed +41
-6
lines changed Expand file tree Collapse file tree 2 files changed +41
-6
lines changed Original file line number Diff line number Diff line change 1010# 2. Run the script ./run_tests.sh
1111
1212# Check for required Oracle environment variables
13- export GORM_DSN=' user="system" password="manager" \
14- connectString="phoenix793630.dev3sub1phx.databasede3phx.oraclevcn.com:1661/cdb1_pdb1.regress.rdbms.dev.us.oracle.com" \
15- libDir="/home/hkhasnis/projects/pkgs/23IC"'
13+ missing_vars=()
14+ for var in GORM_ORACLEDB_USER GORM_ORACLEDB_PASSWORD GORM_ORACLEDB_CONNECTSTRING GORM_ORACLEDB_LIBDIR; do
15+ if [ -z " ${! var} " ]; then
16+ missing_vars+=(" $var " )
17+ fi
18+ done
19+ if [ ${# missing_vars[@]} -ne 0 ]; then
20+ echo " Error: The following environment variables must be set to run the tests: ${missing_vars[*]} "
21+ echo " Example:"
22+ echo " export GORM_ORACLEDB_USER=your_user"
23+ echo " export GORM_ORACLEDB_PASSWORD=your_password"
24+ echo " export GORM_ORACLEDB_CONNECTSTRING=your_connect_string"
25+ echo " export GORM_ORACLEDB_LIBDIR=your_lib_dir"
26+ exit 1
27+ fi
1628
1729# Check if passed-tests.txt exists
1830if [ ! -f " passed-tests.txt" ]; then
Original file line number Diff line number Diff line change @@ -65,9 +65,32 @@ var newLogger = logger.New(
6565 },
6666)
6767
68- var oracleDSN = `user="system" password="manager"
69- connectString="phoenix793630.dev3sub1phx.databasede3phx.oraclevcn.com:1661/cdb1_pdb1.regress.rdbms.dev.us.oracle.com"
70- libDir="/home/hkhasnis/projects/pkgs/23IC"`
68+ var oracleDSN = func () string {
69+ user := os .Getenv ("GORM_ORACLEDB_USER" )
70+ password := os .Getenv ("GORM_ORACLEDB_PASSWORD" )
71+ connectString := os .Getenv ("GORM_ORACLEDB_CONNECTSTRING" )
72+ libDir := os .Getenv ("GORM_ORACLEDB_LIBDIR" )
73+
74+ missing := []string {}
75+ if user == "" {
76+ missing = append (missing , "GORM_ORACLEDB_USER" )
77+ }
78+ if password == "" {
79+ missing = append (missing , "GORM_ORACLEDB_PASSWORD" )
80+ }
81+ if connectString == "" {
82+ missing = append (missing , "GORM_ORACLEDB_CONNECTSTRING" )
83+ }
84+ if libDir == "" {
85+ missing = append (missing , "GORM_ORACLEDB_LIBDIR" )
86+ }
87+ if len (missing ) > 0 {
88+ log .Fatalf ("Missing required environment variables: %v. Please set them to run the tests." , missing )
89+ }
90+ return `user="` + user + `" password="` + password + `"
91+ connectString="` + connectString + `"
92+ libDir="` + libDir + `"`
93+ }()
7194
7295func init () {
7396 var err error
You can’t perform that action at this time.
0 commit comments