Skip to content

Commit 50bb72f

Browse files
Avoid Dropping table
1 parent 2aabe09 commit 50bb72f

File tree

3 files changed

+6
-44
lines changed

3 files changed

+6
-44
lines changed

tests/joins_table_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ func TestOverrideJoinTable(t *testing.T) {
154154
}
155155

156156
func TestOverrideJoinTableInvalidAssociation(t *testing.T) {
157-
DB.Migrator().DropTable(&Person{}, &Address{}, &PersonAddress{})
158157
if err := DB.SetupJoinTable(&Person{}, "Addresses", &PersonAddress{}); err != nil {
159158
t.Fatalf("Failed to setup join table for person, got error %v", err)
160159
}
@@ -172,7 +171,6 @@ func TestOverrideJoinTableInvalidAssociation(t *testing.T) {
172171
}
173172

174173
func TestOverrideJoinTableClearWithoutAssociations(t *testing.T) {
175-
DB.Migrator().DropTable(&Person{}, &Address{}, &PersonAddress{})
176174
if err := DB.SetupJoinTable(&Person{}, "Addresses", &PersonAddress{}); err != nil {
177175
t.Fatalf("Failed to setup join table for person, got error %v", err)
178176
}
@@ -193,7 +191,6 @@ func TestOverrideJoinTableClearWithoutAssociations(t *testing.T) {
193191
}
194192

195193
func TestOverrideJoinTableDeleteNonExistentAssociation(t *testing.T) {
196-
DB.Migrator().DropTable(&Person{}, &Address{}, &PersonAddress{})
197194
if err := DB.SetupJoinTable(&Person{}, "Addresses", &PersonAddress{}); err != nil {
198195
t.Fatalf("Failed to setup join table for person, got error %v", err)
199196
}

tests/run-tests.sh

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,9 @@
1010
# 2. Run the script ./run_tests.sh
1111

1212
# Check for required Oracle environment variables
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
13+
export GORM_DSN='user="system" password="manager" \
14+
connectString="phoenix808593.dev3sub4phx.databasede3phx.oraclevcn.com:1661/cdb1_pdb1.regress.rdbms.dev.us.oracle.com" \
15+
libDir="/home/hkhasnis/projects/pkgs/23IC"'
2816

2917
# Check if passed-tests.txt exists
3018
if [ ! -f "passed-tests.txt" ]; then

tests/tests_test.go

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,32 +65,9 @@ var newLogger = logger.New(
6565
},
6666
)
6767

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-
}()
68+
var oracleDSN = `user="system" password="manager"
69+
connectString="phoenix808593.dev3sub4phx.databasede3phx.oraclevcn.com:1661/cdb1_pdb1.regress.rdbms.dev.us.oracle.com"
70+
libDir="/home/hkhasnis/projects/pkgs/23IC"`
9471

9572
func init() {
9673
var err error

0 commit comments

Comments
 (0)