Skip to content

Fixed preload tests #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/passed-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ TestPreloadGoroutine
TestPreloadWithDiffModel
TestNestedPreloadWithUnscoped
TestNestedPreloadWithNestedJoin
#TestMergeNestedPreloadWithNestedJoin
TestMergeNestedPreloadWithNestedJoin
TestNestedPreloadWithPointerJoin
#TestEmbedPreload
TestEmbedPreload
TestPreparedStmt
TestPreparedStmtFromTransaction
TestPreparedStmtLruFromTransaction
Expand Down
11 changes: 2 additions & 9 deletions tests/preload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import (
)

func TestPreloadWithAssociations(t *testing.T) {
t.Skip()
user := *GetUser("preload_with_associations", Config{
Account: true,
Pets: 2,
Expand Down Expand Up @@ -95,7 +94,6 @@ func TestPreloadWithAssociations(t *testing.T) {
}

func TestNestedPreload(t *testing.T) {
t.Skip()
user := *GetUser("nested_preload", Config{Pets: 2})

for idx, pet := range user.Pets {
Expand Down Expand Up @@ -209,7 +207,6 @@ func TestPreloadWithConds(t *testing.T) {
}

func TestNestedPreloadWithConds(t *testing.T) {
t.Skip()
users := []User{
*GetUser("slice_nested_preload_1", Config{Pets: 2}),
*GetUser("slice_nested_preload_2", Config{Pets: 0}),
Expand Down Expand Up @@ -300,7 +297,6 @@ func TestPreloadGoroutine(t *testing.T) {
}

func TestPreloadWithDiffModel(t *testing.T) {
t.Skip()
user := *GetUser("preload_with_diff_model", Config{Account: true})

if err := DB.Create(&user).Error; err != nil {
Expand All @@ -319,7 +315,6 @@ func TestPreloadWithDiffModel(t *testing.T) {
}

func TestNestedPreloadWithUnscoped(t *testing.T) {
t.Skip()
user := *GetUser("nested_preload", Config{Pets: 1})
pet := user.Pets[0]
pet.Toy = Toy{Name: "toy_nested_preload_" + strconv.Itoa(1)}
Expand Down Expand Up @@ -434,7 +429,6 @@ func TestNestedPreloadWithNestedJoin(t *testing.T) {
}

func TestMergeNestedPreloadWithNestedJoin(t *testing.T) {
t.Skip()
users := []User{
{
Name: "TestMergeNestedPreloadWithNestedJoin-1",
Expand Down Expand Up @@ -473,7 +467,7 @@ func TestMergeNestedPreloadWithNestedJoin(t *testing.T) {
err := sess.
Joins("Manager").
Preload("Manager.Tools").
Where("users.name Like ?", "TestMergeNestedPreloadWithNestedJoin%").
Where("\"users\".\"name\" Like ?", "TestMergeNestedPreloadWithNestedJoin%").
Find(&result).Error

if err != nil {
Expand Down Expand Up @@ -541,7 +535,6 @@ func TestNestedPreloadWithPointerJoin(t *testing.T) {
}

func TestEmbedPreload(t *testing.T) {
t.Skip()
type Country struct {
ID int `gorm:"primaryKey"`
Name string
Expand Down Expand Up @@ -666,7 +659,7 @@ func TestEmbedPreload(t *testing.T) {
for _, test := range testList {
t.Run(test.name, func(t *testing.T) {
actual := Org{}
tx := DB.Where("id = ?", org.ID).Session(&gorm.Session{})
tx := DB.Where("\"id\" = ?", org.ID).Session(&gorm.Session{})
for name, args := range test.preloads {
tx = tx.Preload(name, args...)
}
Expand Down
Loading