codegen: move generated test helpers to new 'db_test.go' file
All checks were successful
CI / build-docker (push) Successful in 4s
CI / build-docker-bootstrap (push) Has been skipped
CI / release-test (push) Successful in 22s

This commit is contained in:
2026-02-15 14:48:49 -08:00
parent ee1d0a5ed7
commit 8ab21edae9
4 changed files with 31 additions and 75 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/exec"
"text/template"
. "git.offline-twitter.com/offline-labs/gas-stack/pkg/flowutils"
)
@@ -39,6 +40,11 @@ func InitPkg(opts PkgOpts) {
PanicIf(os.WriteFile("pkg/db/schema.sql", Must(tpl.ReadFile("tpl/schema.sql")), 0o664))
PanicIf(os.WriteFile("pkg/db/db.go", Must(tpl.ReadFile("tpl/db.go.tpl")), 0o664))
dbTest := Must(os.Create("pkg/db/db_test.go"))
defer MustClose(dbTest)
t := Must(template.ParseFS(tpl, "tpl/db_test.go.tpl"))
PanicIf(t.Execute(dbTest, opts))
PanicIf(os.WriteFile("sample_data/mount.sh", Must(tpl.ReadFile("tpl/mount.sh")), 0o775))
PanicIf(os.WriteFile("sample_data/reset.sh", Must(tpl.ReadFile("tpl/reset.sh")), 0o775))