Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Azuki-bar committed Nov 12, 2023
1 parent 0c3b04c commit ce7a381
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Build State manager
run: |
go build -race backend/state-manager/cmd/main.go
- name: Test
run: |
go test -v ./...
- name: Build State manager
run: |
go build backend/state-manager/cmd/main.go
20 changes: 10 additions & 10 deletions backend/state-manager/pkg/db/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ func Test_ConnectDB(t *testing.T) {
Open()
}

func Test_SetPoint(t *testing.T) {
func Test_UpdatePoint(t *testing.T) {
defer C()
err := godotenv.Load("../../cmd/.env")
if err != nil {
panic(err)
}
Open()
SetPoint(&statev1.PointAndState{
UpdatePoint(&statev1.PointAndState{
Id: "test",
State: statev1.PointStateEnum_POINT_STATE_REVERSE,
})
Expand All @@ -36,14 +36,14 @@ func Test_SetPoint(t *testing.T) {
}
}

func Test_SetStop(t *testing.T) {
func Test_UpdateStop(t *testing.T) {
defer C()
err := godotenv.Load("../../cmd/.env")
if err != nil {
panic(err)
}
Open()
SetStop(&statev1.StopAndState{
UpdateStop(&statev1.StopAndState{
Id: "test",
State: statev1.StopStateEnum_STOP_STATE_GO,
})
Expand All @@ -63,11 +63,11 @@ func Test_GetPoints(t *testing.T) {
panic(err)
}
Open()
SetPoint(&statev1.PointAndState{
UpdatePoint(&statev1.PointAndState{
Id: "test",
State: statev1.PointStateEnum_POINT_STATE_REVERSE,
})
SetPoint(&statev1.PointAndState{
UpdatePoint(&statev1.PointAndState{
Id: "test2",
State: statev1.PointStateEnum_POINT_STATE_NORMAL,
})
Expand All @@ -84,11 +84,11 @@ func Test_GetStops(t *testing.T) {
panic(err)
}
Open()
SetStop(&statev1.StopAndState{
UpdateStop(&statev1.StopAndState{
Id: "test",
State: statev1.StopStateEnum_STOP_STATE_GO,
})
SetStop(&statev1.StopAndState{
UpdateStop(&statev1.StopAndState{
Id: "test2",
State: statev1.StopStateEnum_STOP_STATE_STOP,
})
Expand All @@ -105,14 +105,14 @@ func Test_GetBlocks(t *testing.T) {
panic(err)
}
Open()
err = SetBlock(&statev1.BlockState{
err = UpdateBlock(&statev1.BlockState{
BlockId: "test",
State: statev1.BlockStateEnum_BLOCK_STATE_OPEN,
})
if err != nil {
t.Fatal("error")
}
err = SetBlock(&statev1.BlockState{
err = UpdateBlock(&statev1.BlockState{
BlockId: "test2",
State: statev1.BlockStateEnum_BLOCK_STATE_CLOSE,
})
Expand Down

0 comments on commit ce7a381

Please sign in to comment.