41 lines
820 B
Go
41 lines
820 B
Go
//go:build docker
|
|
// +build docker
|
|
|
|
package feature
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/goravel/framework/facades"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDBDrivers(t *testing.T) {
|
|
connections := []string{"postgres", "mysql", "sqlserver"}
|
|
|
|
for _, connection := range connections {
|
|
database, err := facades.Testing().Docker().Database(connection)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
if err := database.Build(); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
if err := database.Ready(); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
facades.Config().Add("database.default", connection)
|
|
facades.Config().Add("database.connections."+connection+".port", database.Config().Port)
|
|
|
|
facades.App().Refresh()
|
|
|
|
facades.Config().Add("database.default", "sqlite")
|
|
facades.App().Refresh()
|
|
|
|
assert.NoError(t, database.Shutdown())
|
|
}
|
|
}
|