WIP: Transaction implementation
Go Tests / test (pull_request) Failing after 9s

This commit is contained in:
2026-05-24 18:30:00 +02:00
parent 4da3bf231b
commit c86b7cc8cd
4 changed files with 207 additions and 105 deletions
+5 -17
View File
@@ -3,26 +3,14 @@ package simpleorm_test
import (
"testing"
simpleorm "git.gdulai.com/gdulai/simpleorm"
"git.gdulai.com/gdulai/simpleorm/exec"
"git.gdulai.com/gdulai/simpleorm/repository"
log "gitlab.com/gdulai/simpleloglvl"
)
func repoTestSetup() (*simpleorm.ORM, *simpleorm.DBConnection) {
conn := simpleorm.OpenConnection("sqlite3", "file:test.db")
orm := simpleorm.NewORM(Test{}, TestWithFk{}, TestWithFkAndFkId{},
TestWithCompositePk{}, TestWithCompositeFk{})
exec.ExecuteDDL(conn, orm)
return orm, conn
}
func TestRepoSelectAll(t *testing.T) {
// GIVEN
orm, conn := repoTestSetup()
orm, conn := testSetup()
defer cleanUp("test.db", conn)
testObj := Test{Int64Field: 54, IntField: 12, StringField: "asdf"}
@@ -48,7 +36,7 @@ func TestRepoSelectAll(t *testing.T) {
func TestRepoSelectByPk(t *testing.T) {
// GIVEN
orm, conn := repoTestSetup()
orm, conn := testSetup()
defer cleanUp("test.db", conn)
testObj := Test{Int64Field: 54, IntField: 12, StringField: "asdf"}
@@ -74,7 +62,7 @@ func TestRepoSelectByPk(t *testing.T) {
func TestRepoSelectByCompundPk(t *testing.T) {
// GIVEN
orm, conn := repoTestSetup()
orm, conn := testSetup()
defer cleanUp("test.db", conn)
testObj := TestWithCompositePk{ID: 42069, Name: "Test"}
@@ -100,7 +88,7 @@ func TestRepoSelectByCompundPk(t *testing.T) {
func TestRepoSave(t *testing.T) {
// GIVEN
orm, conn := repoTestSetup()
orm, conn := testSetup()
defer cleanUp("test.db", conn)
testObj := &Test{Int64Field: 54, IntField: 12, StringField: "asdf"}
@@ -121,7 +109,7 @@ func TestRepoSave(t *testing.T) {
func TestRepoDelete(t *testing.T) {
// GIVEN
orm, conn := repoTestSetup()
orm, conn := testSetup()
defer cleanUp("test.db", conn)
testObj := &Test{Int64Field: 54, IntField: 12, StringField: "asdf"}