first commit
Some checks failed
Backend Tests / Static Checks (push) Has been cancelled
Backend Tests / Tests (other) (push) Has been cancelled
Backend Tests / Tests (plugin) (push) Has been cancelled
Backend Tests / Tests (server) (push) Has been cancelled
Backend Tests / Tests (store) (push) Has been cancelled
Build Canary Image / build-frontend (push) Has been cancelled
Build Canary Image / build-push (linux/amd64) (push) Has been cancelled
Build Canary Image / build-push (linux/arm64) (push) Has been cancelled
Build Canary Image / merge (push) Has been cancelled
Frontend Tests / Lint (push) Has been cancelled
Frontend Tests / Build (push) Has been cancelled
Proto Linter / Lint Protos (push) Has been cancelled
Some checks failed
Backend Tests / Static Checks (push) Has been cancelled
Backend Tests / Tests (other) (push) Has been cancelled
Backend Tests / Tests (plugin) (push) Has been cancelled
Backend Tests / Tests (server) (push) Has been cancelled
Backend Tests / Tests (store) (push) Has been cancelled
Build Canary Image / build-frontend (push) Has been cancelled
Build Canary Image / build-push (linux/amd64) (push) Has been cancelled
Build Canary Image / build-push (linux/arm64) (push) Has been cancelled
Build Canary Image / merge (push) Has been cancelled
Frontend Tests / Lint (push) Has been cancelled
Frontend Tests / Build (push) Has been cancelled
Proto Linter / Lint Protos (push) Has been cancelled
This commit is contained in:
50
store/test/main_test.go
Normal file
50
store/test/main_test.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// If DRIVER is set, run tests for that driver only
|
||||
if os.Getenv("DRIVER") != "" {
|
||||
defer TerminateContainers()
|
||||
m.Run() //nolint:revive // Exit code is handled by test runner
|
||||
return
|
||||
}
|
||||
|
||||
// No DRIVER set - run tests for all drivers sequentially
|
||||
runAllDrivers()
|
||||
}
|
||||
|
||||
func runAllDrivers() {
|
||||
drivers := []string{"sqlite", "mysql", "postgres"}
|
||||
_, currentFile, _, _ := runtime.Caller(0)
|
||||
projectRoot := filepath.Dir(filepath.Dir(filepath.Dir(currentFile)))
|
||||
|
||||
var failed []string
|
||||
for _, driver := range drivers {
|
||||
fmt.Printf("\n==================== %s ====================\n\n", driver)
|
||||
|
||||
cmd := exec.Command("go", "test", "-v", "-count=1", "./store/test/...")
|
||||
cmd.Dir = projectRoot
|
||||
cmd.Env = append(os.Environ(), "DRIVER="+driver)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
failed = append(failed, driver)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
if len(failed) > 0 {
|
||||
fmt.Printf("FAIL: %v\n", failed)
|
||||
panic("some drivers failed")
|
||||
}
|
||||
fmt.Println("PASS: all drivers")
|
||||
}
|
||||
Reference in New Issue
Block a user