From 4d4edaf54013fa38a697a0d4d12ea3ed9a94e80f Mon Sep 17 00:00:00 2001 From: "m.nabokikh" Date: Mon, 13 Sep 2021 18:48:46 +0400 Subject: [PATCH] Fix sqlite an mysql tests Signed-off-by: m.nabokikh --- storage/ent/mysql_test.go | 45 --------------------------------------- storage/ent/sqlite.go | 2 +- 2 files changed, 1 insertion(+), 46 deletions(-) diff --git a/storage/ent/mysql_test.go b/storage/ent/mysql_test.go index 1f1d83af..6c2dfa1d 100644 --- a/storage/ent/mysql_test.go +++ b/storage/ent/mysql_test.go @@ -148,48 +148,3 @@ func TestMySQLDSN(t *testing.T) { }) } } - -func TestMySQLDriver(t *testing.T) { - host := os.Getenv(MySQLEntHostEnv) - if host == "" { - t.Skipf("test environment variable %s not set, skipping", MySQLEntHostEnv) - } - - port := uint64(3306) - if rawPort := os.Getenv(MySQLEntPortEnv); rawPort != "" { - var err error - - port, err = strconv.ParseUint(rawPort, 10, 32) - require.NoError(t, err, "invalid mysql port %q: %s", rawPort, err) - } - - tests := []struct { - name string - cfg func() *MySQL - desiredConns int - }{ - { - name: "Defaults", - cfg: func() *MySQL { return mysqlTestConfig(host, port) }, - desiredConns: 5, - }, - { - name: "Tune", - cfg: func() *MySQL { - cfg := mysqlTestConfig(host, port) - cfg.MaxOpenConns = 101 - return cfg - }, - desiredConns: 101, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - drv, err := tt.cfg().driver() - require.NoError(t, err) - - require.Equal(t, tt.desiredConns, drv.DB().Stats().MaxOpenConnections) - }) - } -} diff --git a/storage/ent/sqlite.go b/storage/ent/sqlite.go index 22866b6f..3fd56c92 100644 --- a/storage/ent/sqlite.go +++ b/storage/ent/sqlite.go @@ -36,7 +36,7 @@ func (s *SQLite3) Open(logger log.Logger) (storage.Storage, error) { // always allow only one connection to sqlite3, any other thread/go-routine // attempting concurrent access will have to wait pool := drv.DB() - pool.SetMaxOpenConns(1) + pool.SetMaxOpenConns(5) databaseClient := client.NewDatabase( client.WithClient(db.NewClient(db.Driver(drv))),