Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
smith committed Apr 6, 2024
1 parent 6f65331 commit 3ffce63
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
go-version: '1.21'

- name: Build
run: go build -v ./...
Expand Down
7 changes: 4 additions & 3 deletions db/gen/main.go → db/gen/gentool.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package gentool

import (
"github.com/Brandon-lz/myopcua/db"
Expand All @@ -8,9 +8,10 @@ import (

// go test -v -run TestGenInit ./test/gen_test.go

func main() {
func RunGen(genPath string) {
g := gen.NewGenerator(gen.Config{
OutPath: "./query",
// OutPath: "./query",
OutPath: genPath,
Mode: gen.WithoutContext | gen.WithDefaultQuery | gen.WithQueryInterface, // generate mode
FieldNullable: true, // generate nullable fields
})
Expand Down
3 changes: 3 additions & 0 deletions test/routers/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/Brandon-lz/myopcua/config"
sysdb "github.com/Brandon-lz/myopcua/db"
gentool "github.com/Brandon-lz/myopcua/db/gen"
"github.com/Brandon-lz/myopcua/db/gen/query"
globaldata "github.com/Brandon-lz/myopcua/global"
httpservice "github.com/Brandon-lz/myopcua/http_service"
Expand All @@ -25,6 +26,8 @@ func TestMain(t *testing.T) {
cleanDb(assert)
migrateModel()

gentool.RunGen("../../db/gen/query")

config.Init("../../config.toml")
log.Init(slog.LevelDebug)
slog.Info("Starting the opc application...")
Expand Down

0 comments on commit 3ffce63

Please sign in to comment.