Skip to content

Commit 4d4edaf

Browse files
committed
Fix sqlite an mysql tests
Signed-off-by: m.nabokikh <[email protected]>
1 parent fb38e12 commit 4d4edaf

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

storage/ent/mysql_test.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -148,48 +148,3 @@ func TestMySQLDSN(t *testing.T) {
148148
})
149149
}
150150
}
151-
152-
func TestMySQLDriver(t *testing.T) {
153-
host := os.Getenv(MySQLEntHostEnv)
154-
if host == "" {
155-
t.Skipf("test environment variable %s not set, skipping", MySQLEntHostEnv)
156-
}
157-
158-
port := uint64(3306)
159-
if rawPort := os.Getenv(MySQLEntPortEnv); rawPort != "" {
160-
var err error
161-
162-
port, err = strconv.ParseUint(rawPort, 10, 32)
163-
require.NoError(t, err, "invalid mysql port %q: %s", rawPort, err)
164-
}
165-
166-
tests := []struct {
167-
name string
168-
cfg func() *MySQL
169-
desiredConns int
170-
}{
171-
{
172-
name: "Defaults",
173-
cfg: func() *MySQL { return mysqlTestConfig(host, port) },
174-
desiredConns: 5,
175-
},
176-
{
177-
name: "Tune",
178-
cfg: func() *MySQL {
179-
cfg := mysqlTestConfig(host, port)
180-
cfg.MaxOpenConns = 101
181-
return cfg
182-
},
183-
desiredConns: 101,
184-
},
185-
}
186-
187-
for _, tt := range tests {
188-
t.Run(tt.name, func(t *testing.T) {
189-
drv, err := tt.cfg().driver()
190-
require.NoError(t, err)
191-
192-
require.Equal(t, tt.desiredConns, drv.DB().Stats().MaxOpenConnections)
193-
})
194-
}
195-
}

storage/ent/sqlite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (s *SQLite3) Open(logger log.Logger) (storage.Storage, error) {
3636
// always allow only one connection to sqlite3, any other thread/go-routine
3737
// attempting concurrent access will have to wait
3838
pool := drv.DB()
39-
pool.SetMaxOpenConns(1)
39+
pool.SetMaxOpenConns(5)
4040

4141
databaseClient := client.NewDatabase(
4242
client.WithClient(db.NewClient(db.Driver(drv))),

0 commit comments

Comments
 (0)