Skip to content

Commit

Permalink
update oracle_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommi2Day committed Feb 9, 2023
1 parent 5318b48 commit db01b27
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/oracle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ const TIMEOUT = 5
const port = "21521"
const repo = "docker.io/gvenzl/oracle-xe"
const repoTag = "21.3.0-slim"
const containerName = "tnscheck-oracle"
const containerName = "dblib-oracle"
const containerTimeout = 240

var dbhost = common.GetEnv("DB_HOST", "127.0.0.1")
var connectora = fmt.Sprintf("XE.local=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=%s)(PORT=%s)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XEPDB1)))", dbhost, port)
var target string

// func TestMain(m *testing.M) {
func prepare_container() (pool *dockertest.Pool, dbContainer *dockertest.Resource, err error) {
func prepareContainer() (pool *dockertest.Pool, dbContainer *dockertest.Resource, err error) {
dbContainer = nil
pool = nil
if os.Getenv("SKIP_ORACLE") != "" {
err = fmt.Errorf("Skipping ORACLE Container in CI environment")
err = fmt.Errorf("skipping ORACLE Container in CI environment")
return
}
pool, err = dockertest.NewPool("")
if err != nil {
err = fmt.Errorf("Cannot attach to docker: %v", err)
err = fmt.Errorf("cannot attach to docker: %v", err)
return
}
vendorImagePrefix := common.GetEnv("VENDOR_IMAGE_PREFIX", "")
Expand Down Expand Up @@ -93,7 +93,7 @@ func prepare_container() (pool *dockertest.Pool, dbContainer *dockertest.Resourc
err = nil
return
}
func destroy_container(pool *dockertest.Pool, dbContainer *dockertest.Resource) {
func destroyContainer(pool *dockertest.Pool, dbContainer *dockertest.Resource) {
if err := pool.Purge(dbContainer); err != nil {
fmt.Printf("Could not purge resource: %s\n", err)
}
Expand Down Expand Up @@ -129,8 +129,8 @@ func TestWithOracle(t *testing.T) {
require.True(t, found, "Alias not found")
desc := common.RemoveSpace(e.Desc)

pool, dbContainer, err := prepare_container()
defer destroy_container(pool, dbContainer)
pool, dbContainer, err := prepareContainer()
defer destroyContainer(pool, dbContainer)
require.NotNil(t, dbContainer, "Prepare failed")
t.Run("Direct connect", func(t *testing.T) {
var db *sql.DB
Expand Down

0 comments on commit db01b27

Please sign in to comment.