codegen: move generated test helpers to new 'db_test.go' file
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user