Skip to content

Commit

Permalink
Create test databases in /tmp
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Zapletal <lzap+git@redhat.com>
  • Loading branch information
lzap committed Apr 15, 2024
1 parent 1f97c53 commit cc3b59e
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cmd/cleanup/cleanupdevices/cleanupdevices_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestMigrate(t *testing.T) {
func setupTestDB() string {
config.Init()
config.Get().Debug = true
dbName := fmt.Sprintf("%d-cleanupdevices.db", time.Now().UnixNano())
dbName := fmt.Sprintf("/tmp/%d-cleanupdevices.db", time.Now().UnixNano())
config.Get().Database.Name = dbName
db.InitDB()
err := db.DB.AutoMigrate(
Expand Down
2 changes: 1 addition & 1 deletion cmd/cleanup/cleanupimages/cleanupimages_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestMigrate(t *testing.T) {
func setupTestDB() string {
config.Init()
config.Get().Debug = true
dbName := fmt.Sprintf("%d-cleanupimages.db", time.Now().UnixNano())
dbName := fmt.Sprintf("/tmp/%d-cleanupimages.db", time.Now().UnixNano())
config.Get().Database.Name = dbName
db.InitDB()
err := db.DB.AutoMigrate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestCleanupOrphanCommits(t *testing.T) {
func setupTestDB() string {
config.Init()
config.Get().Debug = true
dbName := fmt.Sprintf("%d-cleanuporphancommits.db", time.Now().UnixNano())
dbName := fmt.Sprintf("/tmp/%d-cleanuporphancommits.db", time.Now().UnixNano())
config.Get().Database.Name = dbName
db.InitDB()
err := db.DB.AutoMigrate(
Expand Down
2 changes: 1 addition & 1 deletion cmd/cleanup/deleteimages/deleteimages_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestMigrate(t *testing.T) {
func setupTestDB() string {
config.Init()
config.Get().Debug = true
dbName := fmt.Sprintf("%d-cleanupimages.db", time.Now().UnixNano())
dbName := fmt.Sprintf("/tmp/%d-cleanupimages.db", time.Now().UnixNano())
config.Get().Database.Name = dbName
db.InitDB()
err := db.DB.AutoMigrate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestMigrate(t *testing.T) {

func setupTestDB() string {
config.Init()
dbName := fmt.Sprintf("%d-migrategroups.db", time.Now().UnixNano())
dbName := fmt.Sprintf("/tmp/%d-migrategroups.db", time.Now().UnixNano())
config.Get().Database.Name = dbName
db.InitDB()
if err := db.DB.AutoMigrate(
Expand Down
2 changes: 1 addition & 1 deletion cmd/migraterepos/migraterepos/migraterepos_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestMigrate(t *testing.T) {

func setupTestDB() string {
config.Init()
dbName := fmt.Sprintf("%d-migraterepos.db", time.Now().UnixNano())
dbName := fmt.Sprintf("/tmp/%d-migraterepos.db", time.Now().UnixNano())
config.Get().Database.Name = dbName
db.InitDB()
if err := db.DB.AutoMigrate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestPostMigrate(t *testing.T) {

func setupTestDB() string {
config.Init()
dbName := fmt.Sprintf("%d-migraterepos.db", time.Now().UnixNano())
dbName := fmt.Sprintf("/tmp/%d-migraterepos.db", time.Now().UnixNano())
config.Get().Database.Name = dbName
db.InitDB()
if err := db.DB.AutoMigrate(
Expand Down
2 changes: 1 addition & 1 deletion cmd/migraterepos/repairrepos/repairrepos_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestMigrate(t *testing.T) {
func setupTestDB() string {
config.Init()
config.Get().Debug = true
dbName := fmt.Sprintf("%d-repairrepos.db", time.Now().UnixNano())
dbName := fmt.Sprintf("/tmp/%d-repairrepos.db", time.Now().UnixNano())
config.Get().Database.Name = dbName
db.InitDB()
err := db.DB.AutoMigrate(
Expand Down
2 changes: 1 addition & 1 deletion pkg/clients/imagebuilder/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var _ = Describe("Image Builder Client Test", func() {
Expect(err).ToNot(HaveOccurred())
config.Init()
config.Get().Debug = true
dbName = fmt.Sprintf("%d-client.db", time.Now().UnixNano())
dbName = fmt.Sprintf("/tmp/%d-client.db", time.Now().UnixNano())
config.Get().Database.Name = dbName
db.InitDB()

Expand Down
2 changes: 1 addition & 1 deletion pkg/db/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var _ = Describe("Db", func() {

BeforeEach(func() {
dbTimeCreation := time.Now().UnixNano()
dbName = fmt.Sprintf("%d-dbtest.db", dbTimeCreation)
dbName = fmt.Sprintf("/tmp/%d-dbtest.db", dbTimeCreation)
originalDBName = config.Get().Database.Name
config.Get().Database.Name = dbName
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var dbName string

func setupTestDB() {
dbTimeCreation := time.Now().UnixNano()
dbName = fmt.Sprintf("%d-services.db", dbTimeCreation)
dbName = fmt.Sprintf("/tmp/%d-services.db", dbTimeCreation)
config.Get().Database.Name = dbName
InitDB()
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/models/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var dbName string

func setUp() {
dbTimeCreation := time.Now().UnixNano()
dbName = fmt.Sprintf("%d-models.db", dbTimeCreation)
dbName = fmt.Sprintf("/tmp/%d-models.db", dbTimeCreation)
config.Get().Database.Name = dbName
db.InitDB()

Expand Down
2 changes: 1 addition & 1 deletion pkg/routes/common/filters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func setUp() {
config.Init()
config.Get().Debug = true
time := time.Now().UnixNano()
dbName = fmt.Sprintf("%d-routes-common.db", time)
dbName = fmt.Sprintf("/tmp/%d-routes-common.db", time)
config.Get().Database.Name = dbName
db.InitDB()
db.DB.AutoMigrate(&models.Image{})
Expand Down
2 changes: 1 addition & 1 deletion pkg/routes/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var dbName string
func setUp() {
config.Init()
config.Get().Debug = true
dbName = fmt.Sprintf("%d-routes.db", time.Now().UnixNano())
dbName = fmt.Sprintf("/tmp/%d-routes.db", time.Now().UnixNano())
config.Get().Database.Name = dbName
db.InitDB()
err := db.DB.AutoMigrate(
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func setupTestDB() {
config.Init()
config.Get().Debug = true
time := time.Now().UnixNano()
dbName = fmt.Sprintf("%d-services.db", time)
dbName = fmt.Sprintf("/tmp/%d-services.db", time)
config.Get().Database.Name = dbName
db.InitDB()
err := db.DB.AutoMigrate(
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/update/update_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var dbName string
func setUp() {
config.Init()
time := time.Now().UnixNano()
dbName = fmt.Sprintf("%d-models.db", time)
dbName = fmt.Sprintf("/tmp/%d-models.db", time)
config.Get().Database.Name = dbName
db.InitDB()
err := db.DB.AutoMigrate(
Expand Down

0 comments on commit cc3b59e

Please sign in to comment.