Skip to content

Commit

Permalink
Merge pull request #122 from nats-io/remove_redelivery_honor_maxinflight
Browse files Browse the repository at this point in the history
Remove test and update Travis
  • Loading branch information
kozlovic committed Dec 5, 2016
2 parents c2bd111 + 0e3b2c6 commit bd853f5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 46 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: go
sudo: false
go:
- 1.5.4
- 1.6.3
- 1.7.4
install:
- go get -t ./...
- go get github.com/nats-io/nats-streaming-server
Expand Down
45 changes: 0 additions & 45 deletions stan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,51 +1054,6 @@ func TestRedelivery(t *testing.T) {
}
}

func TestRedeliveryHonorMaxInflight(t *testing.T) {
// Run a NATS Streaming server
s := RunServer(clusterName)
defer s.Shutdown()

sc := NewDefaultConnection(t)
defer sc.Close()

toSend := int32(100)
hw := []byte("Hello World")

for i := int32(0); i < toSend; i++ {
sc.Publish("foo", hw)
}

errCh := make(chan string)
received := int32(0)

ackRedeliverTime := 1 * time.Second

sub, err := sc.Subscribe("foo", func(m *Msg) {
if m.Redelivered {
errCh <- fmt.Sprintf("Message %d was redelivered", m.Sequence)
return
}
atomic.AddInt32(&received, 1)

}, DeliverAllAvailable(), MaxInflight(100), AckWait(ackRedeliverTime), SetManualAckMode())
if err != nil {
t.Fatalf("Unexpected error on Subscribe, got %v\n", err)
}
defer sub.Unsubscribe()

select {
case e := <-errCh:
t.Fatalf("%s", e)
case <-time.After(2 * time.Second):
// Wait for up to 2 seconds to see if messages are redelivered
break
}
if nr := atomic.LoadInt32(&received); nr != toSend {
t.Fatalf("Expected to get 100 messages, got %d\n", nr)
}
}

func checkTime(t *testing.T, label string, time1, time2 time.Time, expected time.Duration, tolerance time.Duration) {
duration := time2.Sub(time1)

Expand Down

0 comments on commit bd853f5

Please sign in to comment.