Skip to content

Commit 440188b

Browse files
YDBENT-2: fixed tests
1 parent 006ca41 commit 440188b

File tree

6 files changed

+90
-73
lines changed

6 files changed

+90
-73
lines changed

dialect/ydb/driver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024-present Facebook Inc. All rights reserved.
1+
// Copyright 2019-present Facebook Inc. All rights reserved.
22
// This source code is licensed under the Apache 2.0 license found
33
// in the LICENSE file in the root directory of this source tree.
44

@@ -35,10 +35,10 @@ func Open(ctx context.Context, dsn string) (*YDBDriver, error) {
3535
panic(err)
3636
}
3737

38-
dbSqlDriver := sql.OpenDB(conn)
38+
dbSQLDriver := sql.OpenDB(conn)
3939

4040
return &YDBDriver{
41-
Driver: entSql.OpenDB(dialect.YDB, dbSqlDriver),
41+
Driver: entSql.OpenDB(dialect.YDB, dbSQLDriver),
4242
nativeDriver: nativeDriver,
4343
}, nil
4444
}

dialect/ydb/driver_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024-present Facebook Inc. All rights reserved.
1+
// Copyright 2019-present Facebook Inc. All rights reserved.
22
// This source code is licensed under the Apache 2.0 license found
33
// in the LICENSE file in the root directory of this source tree.
44

@@ -90,7 +90,7 @@ func TestExecInsert(t *testing.T) {
9090
require.NoError(t, err, "INSERT data execute without err")
9191

9292
// Then - verify row count
93-
mock.ExpectQuery("SELECT COUNT(*) AS").
93+
mock.ExpectQuery("SELECT COUNT\\(\\*\\) AS").
9494
WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1))
9595

9696
var rows entSql.Rows
@@ -131,7 +131,7 @@ func TestExecUpdate(t *testing.T) {
131131
require.NoError(t, err, "should update data")
132132

133133
// Then
134-
mock.ExpectQuery("SELECT * FROM test_users").
134+
mock.ExpectQuery("SELECT \\* FROM test_users").
135135
WillReturnRows(sqlmock.NewRows([]string{"id", "name", "age"}).
136136
AddRow(1, "Alice", 31))
137137

@@ -174,7 +174,7 @@ func TestExecDelete(t *testing.T) {
174174
require.NoError(t, err, "DELETE request should execute without err")
175175

176176
// Then
177-
mock.ExpectQuery("SELECT COUNT(*)").
177+
mock.ExpectQuery("SELECT COUNT\\(\\*\\)").
178178
WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0))
179179

180180
var rows entSql.Rows
@@ -200,7 +200,7 @@ func TestQueryEmptyTable(t *testing.T) {
200200
drv := &YDBDriver{Driver: entSql.OpenDB(dialect.YDB, db)}
201201

202202
// When
203-
mock.ExpectQuery("SELECT * FROM test_users").
203+
mock.ExpectQuery("SELECT \\* FROM test_users").
204204
WillReturnRows(sqlmock.NewRows([]string{"id", "name", "age"}))
205205

206206
var rows entSql.Rows
@@ -239,7 +239,7 @@ func TestExecMultipleInserts(t *testing.T) {
239239
}
240240

241241
// Then
242-
mock.ExpectQuery("SELECT COUNT(*)").
242+
mock.ExpectQuery("SELECT COUNT\\(\\*\\)").
243243
WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(10))
244244

245245
var rows entSql.Rows
@@ -266,7 +266,7 @@ func TestQueryInvalidQuery(t *testing.T) {
266266

267267
// When
268268
invalidQuery := "SELECT * FROM non_existent_table"
269-
mock.ExpectQuery("SELECT * FROM non_existent_table").
269+
mock.ExpectQuery("SELECT \\* FROM non_existent_table").
270270
WillReturnError(fmt.Errorf("table not found"))
271271

272272
var rows entSql.Rows

entc/integration/go.mod

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module entgo.io/ent/entc/integration
22

3-
go 1.24
4-
5-
toolchain go1.24.0
3+
go 1.24.0
64

75
replace entgo.io/ent => ../../
86

@@ -11,11 +9,11 @@ require (
119
ariga.io/atlas-go-sdk v0.6.9
1210
entgo.io/ent v0.0.0-00010101000000-000000000000
1311
github.com/go-sql-driver/mysql v1.7.0
14-
github.com/google/uuid v1.3.0
12+
github.com/google/uuid v1.6.0
1513
github.com/lib/pq v1.10.7
1614
github.com/mattn/go-sqlite3 v1.14.28
17-
github.com/stretchr/testify v1.8.4
18-
golang.org/x/sync v0.11.0
15+
github.com/stretchr/testify v1.10.0
16+
golang.org/x/sync v0.17.0
1917
)
2018

2119
require (
@@ -24,7 +22,7 @@ require (
2422
github.com/bmatcuk/doublestar v1.3.4 // indirect
2523
github.com/davecgh/go-spew v1.1.1 // indirect
2624
github.com/go-openapi/inflect v0.19.0 // indirect
27-
github.com/google/go-cmp v0.6.0 // indirect
25+
github.com/google/go-cmp v0.7.0 // indirect
2826
github.com/hashicorp/hcl/v2 v2.18.1 // indirect
2927
github.com/json-iterator/go v1.1.12 // indirect
3028
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
@@ -33,10 +31,10 @@ require (
3331
github.com/modern-go/reflect2 v1.0.2 // indirect
3432
github.com/pmezard/go-difflib v1.0.0 // indirect
3533
github.com/rogpeppe/go-internal v1.11.0 // indirect
36-
github.com/stretchr/objx v0.5.0 // indirect
34+
github.com/stretchr/objx v0.5.2 // indirect
3735
github.com/zclconf/go-cty v1.14.4 // indirect
3836
github.com/zclconf/go-cty-yaml v1.1.0 // indirect
39-
golang.org/x/mod v0.24.0 // indirect
40-
golang.org/x/text v0.21.0 // indirect
37+
golang.org/x/mod v0.28.0 // indirect
38+
golang.org/x/text v0.30.0 // indirect
4139
gopkg.in/yaml.v3 v3.0.1 // indirect
4240
)

entc/integration/go.sum

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ
1919
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
2020
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
2121
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
22-
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
23-
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
22+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
23+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
2424
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
25-
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
26-
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
25+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
26+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
2727
github.com/hashicorp/hcl/v2 v2.18.1 h1:6nxnOJFku1EuSawSD81fuviYUV8DxFr3fp2dUi3ZYSo=
2828
github.com/hashicorp/hcl/v2 v2.18.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE=
2929
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
@@ -58,29 +58,25 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
5858
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
5959
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
6060
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
61-
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
62-
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
63-
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
61+
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
62+
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
6463
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
65-
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
66-
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
67-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
68-
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
64+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
65+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
6966
github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8=
7067
github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
7168
github.com/zclconf/go-cty-yaml v1.1.0 h1:nP+jp0qPHv2IhUVqmQSzjvqAWcObN0KBkUl2rWBdig0=
7269
github.com/zclconf/go-cty-yaml v1.1.0/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs=
73-
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
74-
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
75-
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
76-
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
77-
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
78-
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
79-
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
80-
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
70+
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
71+
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
72+
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
73+
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
74+
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
75+
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
76+
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
77+
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
8178
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
8279
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
8380
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
84-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
8581
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
8682
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

examples/go.mod

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
module entgo.io/ent/examples
22

3-
go 1.24
4-
5-
toolchain go1.24.0
3+
go 1.24.0
64

75
replace entgo.io/ent => ../
86

97
require (
108
ariga.io/atlas v0.36.2-0.20250730182955-2c6300d0a3e1
119
ariga.io/atlas-go-sdk v0.6.9
1210
entgo.io/ent v0.0.0-00010101000000-000000000000
13-
github.com/google/uuid v1.3.0
11+
github.com/google/uuid v1.6.0
1412
github.com/lib/pq v1.10.7
1513
github.com/mattn/go-sqlite3 v1.14.28
16-
github.com/stretchr/testify v1.8.4
14+
github.com/stretchr/testify v1.10.0
1715
gocloud.dev v0.28.0
1816
)
1917

@@ -24,24 +22,23 @@ require (
2422
github.com/davecgh/go-spew v1.1.1 // indirect
2523
github.com/go-openapi/inflect v0.19.0 // indirect
2624
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
27-
github.com/golang/protobuf v1.5.2 // indirect
28-
github.com/google/go-cmp v0.6.0 // indirect
25+
github.com/google/go-cmp v0.7.0 // indirect
2926
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
3027
github.com/hashicorp/hcl/v2 v2.18.1 // indirect
3128
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
3229
github.com/pmezard/go-difflib v1.0.0 // indirect
3330
github.com/zclconf/go-cty v1.14.4 // indirect
3431
github.com/zclconf/go-cty-yaml v1.1.0 // indirect
3532
go.opencensus.io v0.24.0 // indirect
36-
golang.org/x/crypto v0.3.0 // indirect
37-
golang.org/x/mod v0.24.0 // indirect
38-
golang.org/x/net v0.6.0 // indirect
39-
golang.org/x/sys v0.30.0 // indirect
40-
golang.org/x/text v0.21.0 // indirect
33+
golang.org/x/crypto v0.43.0 // indirect
34+
golang.org/x/mod v0.28.0 // indirect
35+
golang.org/x/net v0.46.0 // indirect
36+
golang.org/x/sys v0.37.0 // indirect
37+
golang.org/x/text v0.30.0 // indirect
4138
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
4239
google.golang.org/api v0.103.0 // indirect
4340
google.golang.org/genproto v0.0.0-20221201204527-e3fa12d562f3 // indirect
44-
google.golang.org/grpc v1.51.0 // indirect
45-
google.golang.org/protobuf v1.28.1 // indirect
41+
google.golang.org/grpc v1.76.0 // indirect
42+
google.golang.org/protobuf v1.36.10 // indirect
4643
gopkg.in/yaml.v3 v3.0.1 // indirect
4744
)

0 commit comments

Comments
 (0)