Skip to content

Commit 275bb51

Browse files
fix/updated api sync monitor tests
1 parent e17237d commit 275bb51

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ jobs:
156156
name: "Run unit tests with gotestsum"
157157
command: |
158158
mkdir -p report/unit report/integration
159-
gotestsum -f standard-verbose --junitfile report/unit/tests.xml -- -short -race ./...
159+
gotestsum -f standard-verbose --junitfile report/unit/tests.xml -- -short -race -count=1 -p 1 ./...
160160
- run:
161161
name: Wait for PostgreSQL
162162
command: |

rolling-shutter/keyperimpl/shutterservice/syncmonitor_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package shutterservice
1+
package shutterservice_test
22

33
import (
44
"context"
@@ -7,12 +7,13 @@ import (
77

88
"gotest.tools/assert"
99

10+
"github.com/shutter-network/rolling-shutter/rolling-shutter/keyperimpl/shutterservice"
1011
"github.com/shutter-network/rolling-shutter/rolling-shutter/keyperimpl/shutterservice/database"
1112
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/service"
1213
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/testsetup"
1314
)
1415

15-
func TestSyncMonitor_ThrowsErrorWhenBlockNotIncreasing(t *testing.T) {
16+
func TestAPISyncMonitor_ThrowsErrorWhenBlockNotIncreasing(t *testing.T) {
1617
ctx, cancel := context.WithCancel(context.Background())
1718
defer cancel()
1819

@@ -30,7 +31,7 @@ func TestSyncMonitor_ThrowsErrorWhenBlockNotIncreasing(t *testing.T) {
3031
t.Fatalf("failed to set initial synced data: %v", err)
3132
}
3233

33-
monitor := &SyncMonitor{
34+
monitor := &shutterservice.SyncMonitor{
3435
DBPool: dbpool,
3536
CheckInterval: 5 * time.Second,
3637
}
@@ -54,7 +55,7 @@ func TestSyncMonitor_ThrowsErrorWhenBlockNotIncreasing(t *testing.T) {
5455
}
5556
}
5657

57-
func TestSyncMonitor_HandlesBlockNumberIncreasing(t *testing.T) {
58+
func TestAPISyncMonitor_HandlesBlockNumberIncreasing(t *testing.T) {
5859
ctx, cancel := context.WithCancel(context.Background())
5960
defer cancel()
6061

@@ -71,7 +72,7 @@ func TestSyncMonitor_HandlesBlockNumberIncreasing(t *testing.T) {
7172
t.Fatalf("failed to set initial synced data: %v", err)
7273
}
7374

74-
monitor := &SyncMonitor{
75+
monitor := &shutterservice.SyncMonitor{
7576
DBPool: dbpool,
7677
CheckInterval: 5 * time.Second,
7778
}
@@ -107,15 +108,15 @@ func TestSyncMonitor_HandlesBlockNumberIncreasing(t *testing.T) {
107108
assert.Equal(t, initialBlockNumber+5, syncedData.BlockNumber, "block number should have been incremented correctly")
108109
}
109110

110-
func TestSyncMonitor_ContinuesWhenNoRows(t *testing.T) {
111+
func TestAPISyncMonitor_ContinuesWhenNoRows(t *testing.T) {
111112
ctx, cancel := context.WithCancel(context.Background())
112113
defer cancel()
113114

114115
dbpool, closeDB := testsetup.NewTestDBPool(ctx, t, database.Definition)
115116
defer closeDB()
116117
_ = database.New(dbpool)
117118

118-
monitor := &SyncMonitor{
119+
monitor := &shutterservice.SyncMonitor{
119120
DBPool: dbpool,
120121
CheckInterval: 5 * time.Second,
121122
}

0 commit comments

Comments
 (0)