github.com/pavlo67/common@v0.5.3/common/sqllib/sqllib_sqlite/connext_test.go (about)

     1  package sqllib_sqlite
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/pavlo67/common/common/config"
     9  	"github.com/pavlo67/common/common/sqllib"
    10  )
    11  
    12  func TestConnect(t *testing.T) {
    13  
    14  	envs, _ := config.PrepareTests(
    15  		t,
    16  		"../../../_envs/",
    17  		"", // "connect_test."+strconv.FormatInt(time.Now().Unix(), 10)+".log",
    18  	)
    19  
    20  	//var cfgSqlite config.Access
    21  	//err := envs.Value("sqllib_sqlite", &cfgSqlite)
    22  	//require.NoError(t, err)
    23  	//
    24  	//cfgSqlite.Path, err = filelib.Dir(cfgSqlite.Path)
    25  	//require.NoError(t, err)
    26  	//require.NotEmpty(t, cfgSqlite.Path)
    27  	//
    28  	//cfgSqlite.Path += "test_connect.sqlite"
    29  
    30  	var cfgSqlite config.Access
    31  	err := envs.Value("db_sqlite", &cfgSqlite)
    32  	require.NoError(t, err)
    33  
    34  	db, err := Connect(cfgSqlite)
    35  	require.NoError(t, err)
    36  	require.NotNil(t, db)
    37  
    38  	sqllib.TestDB(t, db)
    39  
    40  }