diff --git a/tests/compose.yml b/tests/compose.yml index f43fe82a..fdce1b88 100644 --- a/tests/compose.yml +++ b/tests/compose.yml @@ -1,6 +1,6 @@ services: mysql: - image: 'mysql/mysql-server:latest' + image: 'mysql:latest' ports: - "127.0.0.1:9910:3306" environment: diff --git a/tests/go.mod b/tests/go.mod index d5e23efa..1074f2b9 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -7,9 +7,9 @@ require ( github.com/jinzhu/now v1.1.5 github.com/lib/pq v1.10.9 github.com/stretchr/testify v1.10.0 - gorm.io/driver/mysql v1.5.7 + gorm.io/driver/mysql v1.6.0 gorm.io/driver/postgres v1.6.0 - gorm.io/driver/sqlite v1.5.7 + gorm.io/driver/sqlite v1.6.0 gorm.io/driver/sqlserver v1.6.0 gorm.io/gorm v1.30.0 ) @@ -27,7 +27,7 @@ require ( github.com/jinzhu/inflection v1.0.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/mattn/go-sqlite3 v1.14.28 // indirect - github.com/microsoft/go-mssqldb v1.8.1 // indirect + github.com/microsoft/go-mssqldb v1.8.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect golang.org/x/crypto v0.38.0 // indirect diff --git a/tests/multi_primary_keys_test.go b/tests/multi_primary_keys_test.go index 4a7ab9f6..4ecbff6a 100644 --- a/tests/multi_primary_keys_test.go +++ b/tests/multi_primary_keys_test.go @@ -41,7 +41,7 @@ func TestManyToManyWithMultiPrimaryKeys(t *testing.T) { t.Skip("skip sqlite, sqlserver due to it doesn't support multiple primary keys with auto increment") } - if name := DB.Dialector.Name(); name == "postgres" { + if name := DB.Dialector.Name(); name == "postgres" || name == "mysql" { stmt := gorm.Statement{DB: DB} stmt.Parse(&Blog{}) stmt.Schema.LookUpField("ID").Unique = true @@ -264,7 +264,7 @@ func TestManyToManyWithCustomizedForeignKeys2(t *testing.T) { t.Skip("skip sqlite, sqlserver due to it doesn't support multiple primary keys with auto increment") } - if name := DB.Dialector.Name(); name == "postgres" { + if name := DB.Dialector.Name(); name == "postgres" || name == "mysql" { t.Skip("skip postgres due to it only allow unique constraint matching given keys") } @@ -332,7 +332,7 @@ func TestManyToManyWithCustomizedForeignKeys2(t *testing.T) { DB.Model(&blog2).Association("LocaleTags").Find(&tags) if !compareTags(tags, []string{"tag4"}) { - t.Fatalf("Should find 1 tags for EN Blog") + t.Fatalf("Should find 1 tags for EN Blog, but got %v", tags) } // Replace diff --git a/tests/preload_suits_test.go b/tests/preload_suits_test.go index b5b6a70f..569fee58 100644 --- a/tests/preload_suits_test.go +++ b/tests/preload_suits_test.go @@ -696,6 +696,10 @@ func TestManyToManyPreloadWithMultiPrimaryKeys(t *testing.T) { t.Skip("skip sqlite, sqlserver due to it doesn't support multiple primary keys with auto increment") } + if name := DB.Dialector.Name(); name == "mysql" { + t.Skip("skip mysql due to it only allow unique constraint matching given keys") + } + type ( Level1 struct { ID uint `gorm:"primary_key;"`