Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Adding check for short flag in the longer running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peteclark-ft committed Apr 13, 2017
1 parent 4b1d394 commit 4b139ba
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
9 changes: 9 additions & 0 deletions scheduler/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ const cycleConfigFile = "test/cycle_test.yml"
const expectedColletion = "a-collection"

func TestSchedulerShouldStartWhenEnabled(t *testing.T) {
if testing.Short() {
t.Skip("Skipping - this test can take several seconds.")
return
}

db := new(native.MockDB)
s := NewScheduler(db, &tasks.MockTask{}, &MockMetadataRW{}, 1*time.Minute)

Expand All @@ -39,6 +44,10 @@ func TestSchedulerShouldStartWhenEnabled(t *testing.T) {
}

func TestSchedulerDoNotStartWhenDisabled(t *testing.T) {
if testing.Short() {
t.Skip("Skipping - this test can take several seconds.")
return
}

db := new(native.MockDB)
s := NewScheduler(db, &tasks.MockTask{}, &MockMetadataRW{}, 1*time.Minute)
Expand Down
10 changes: 10 additions & 0 deletions scheduler/throttle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import (
)

func TestDynamicThrottle(t *testing.T) {
if testing.Short() {
t.Skip("Skipping - this test can take several seconds.")
return
}

throttle, _ := NewDynamicThrottle(1*time.Second, 1*time.Second, 1, 1)
start := time.Now()
throttle.Queue()
Expand All @@ -25,6 +30,11 @@ func TestDynamicThrottle(t *testing.T) {
}

func TestCappedThrottle(t *testing.T) {
if testing.Short() {
t.Skip("Skipping - this test can take several seconds.")
return
}

throttle, _ := NewCappedDynamicThrottle(time.Minute, time.Millisecond, 100*time.Millisecond, 1, 1)
start := time.Now()
throttle.Queue()
Expand Down
1 change: 0 additions & 1 deletion scheduler/throttled_whole_collection_cycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func (l *ThrottledWholeCollectionCycle) Start() {
}

func (l *ThrottledWholeCollectionCycle) start(ctx context.Context) {

skip := l.PublishedItems()

b := true
Expand Down
15 changes: 15 additions & 0 deletions scheduler/throttled_whole_collection_cycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import (
)

func TestWholeCollectionCycleRun(t *testing.T) {
if testing.Short() {
t.Skip("Skipping - this test can take several seconds.")
return
}

db := new(native.MockDB)
mockTx := new(native.MockTX)
iter := new(native.MockDBIter)
Expand Down Expand Up @@ -49,6 +54,11 @@ func TestWholeCollectionCycleRun(t *testing.T) {
}

func TestWholeCollectionCycleRunMongoDBConnectionError(t *testing.T) {
if testing.Short() {
t.Skip("Skipping - this test can take several seconds.")
return
}

db := new(native.MockDB)
mockTx := new(native.MockTX)
db.On("Open").Return(mockTx, errors.New("error in DB connection")).After(1 * time.Second)
Expand All @@ -75,6 +85,11 @@ func TestWholeCollectionCycleRunMongoDBConnectionError(t *testing.T) {
}

func TestWholeCollectionCycleRunEmptyCollection(t *testing.T) {
if testing.Short() {
t.Skip("Skipping - this test can take several seconds.")
return
}

db := new(native.MockDB)
mockTx := new(native.MockTX)
iter := new(native.MockDBIter)
Expand Down

0 comments on commit 4b139ba

Please sign in to comment.