Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
go-orusapi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orus-io
go-orusapi
Commits
7209cf17ed9a
Commit
7209cf17ed9a
authored
1 year ago
by
Christophe de Vienne
Browse files
Options
Downloads
Patches
Plain Diff
database: add a 'NoClean' test db getter
parent
c2de70faf5fb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#76090
passed
1 year ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
database/test.go
+7
-5
7 additions, 5 deletions
database/test.go
with
7 additions
and
5 deletions
database/test.go
+
7
−
5
View file @
7209cf17
...
@@ -10,9 +10,7 @@
...
@@ -10,9 +10,7 @@
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
)
)
var
(
var
dbtablenames
[]
string
dbtablenames
[]
string
)
const
dbLockID
=
15104
const
dbLockID
=
15104
...
@@ -123,6 +121,12 @@
...
@@ -123,6 +121,12 @@
// GetTestDB creates a db and returns it. It must be closed within the test.
// GetTestDB creates a db and returns it. It must be closed within the test.
// If it fails, t.Fatal() is called
// If it fails, t.Fatal() is called
func
GetTestDB
(
ctx
context
.
Context
,
t
testing
.
TB
,
sourceDriver
source
.
Driver
)
*
TestDB
{
func
GetTestDB
(
ctx
context
.
Context
,
t
testing
.
TB
,
sourceDriver
source
.
Driver
)
*
TestDB
{
db
:=
GetTestDBNoClear
(
ctx
,
t
,
sourceDriver
)
db
.
ClearDB
()
return
db
}
func
GetTestDBNoClear
(
ctx
context
.
Context
,
t
testing
.
TB
,
sourceDriver
source
.
Driver
)
*
TestDB
{
var
success
bool
var
success
bool
dsn
:=
getDSN
(
t
)
dsn
:=
getDSN
(
t
)
...
@@ -187,8 +191,6 @@
...
@@ -187,8 +191,6 @@
);
err
!=
nil
{
);
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
}
else
{
testDB
.
ClearDB
()
}
}
success
=
true
success
=
true
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment