Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
smith committed Apr 6, 2024
1 parent cf92f76 commit 341f5fa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,8 @@ jobs:
- name: run opcserver
run: docker compose -f opc_ua/docker-compose-local.yml up -d

- name: run server
run: env git_test=1 go run main.go

- name: Test
run: env git_test=1 go test -v ./...
1 change: 0 additions & 1 deletion http_service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func Start(ctx context.Context) {
}
// catching ctx.Done(). timeout of 5 seconds.
<-ctx.Done()
slog.Info("timeout of 5 seconds.")
slog.Info("Server exiting")
}

Expand Down
14 changes: 7 additions & 7 deletions test/routers/init_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package test

import (
"context"
// "context"
"log/slog"
"os"
"testing"
Expand All @@ -12,9 +12,9 @@ import (
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"
// httpservice "github.com/Brandon-lz/myopcua/http_service"
"github.com/Brandon-lz/myopcua/log"
opcservice "github.com/Brandon-lz/myopcua/opc_service"
// opcservice "github.com/Brandon-lz/myopcua/opc_service"
"github.com/stretchr/testify/assert"
)

Expand All @@ -35,18 +35,18 @@ func TestMain(t *testing.T) {
sysdb.InitDB()
query.SetDefault(sysdb.DB) // init gen model, for decouple with db
globaldata.InitSystemVars()
ctx,cancel := context.WithCancel(context.Background())
// ctx,cancel := context.WithCancel(context.Background())

go opcservice.Start(ctx)
go httpservice.Start(ctx)
// go opcservice.Start(ctx)
// go httpservice.Start(ctx)

time.Sleep(1 * time.Second)

// Run router tests ---------------------------------
t.Run("Test_AddWebhookConfig", testAddWebhookConfig)
t.Run("Test_getWebhookConfig", testGetWebhookConfigById)

cancel()
// cancel()


}
Expand Down

0 comments on commit 341f5fa

Please sign in to comment.