Rename the module, proto service, and all identifiers from simple_bank/ SimpleBank to api_tmpl/ApiTmpl, and regenerate the gRPC/gateway/swagger/ mock code accordingly. - Scrub real secrets (SMTP password, auth token secret) from api.env/ api_test.env, untrack them, and add api.env.example/api_test.env.example - Remove committed build artifacts (tmp/main, tmp/build-errors.log, dbml-error.log) and gitignore them going forward - Fix Dockerfile paths (build target, migrations copy) that referenced a stale project layout - Rewrite README to match the actual cmd/ + internal/ structure and add a "using this as a template" section
31 lines
540 B
Go
31 lines
540 B
Go
package db
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/FernandoJVideira/api_tmpl/internal/config"
|
|
"github.com/jackc/pgx/v5/pgxpool"
|
|
_ "github.com/jackc/pgx/v5/stdlib"
|
|
)
|
|
|
|
var testStore Store
|
|
|
|
func TestMain(m *testing.M) {
|
|
config, err := config.LoadTestConfig("../../..")
|
|
if err != nil {
|
|
log.Fatal("cannot load config:", err)
|
|
}
|
|
|
|
connPool, err := pgxpool.New(context.Background(), config.DBAddr)
|
|
if err != nil {
|
|
log.Fatal("cannot connect to db:", err)
|
|
}
|
|
|
|
testStore = NewPostgresStore(connPool)
|
|
|
|
os.Exit(m.Run())
|
|
}
|