Skip to content

Commit

Permalink
Merge pull request #118 from nats-io/update_start_sequence_time_tests
Browse files Browse the repository at this point in the history
Updated tests related to StartAtTimeDelta and StartAtSequence
  • Loading branch information
kozlovic authored Nov 15, 2016
2 parents c39373c + 64183fb commit 5acd879
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions stan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,12 +516,6 @@ func TestSubscriptionStartAtSequence(t *testing.T) {
sc.Publish("foo", data)
}

// Check for illegal sequences
_, err := sc.Subscribe("foo", nil, StartAtSequence(500))
if err == nil {
t.Fatalf("Expected non-nil error on Subscribe")
}

ch := make(chan bool)
received := int32(0)
shouldReceive := int32(5)
Expand Down Expand Up @@ -594,12 +588,6 @@ func TestSubscriptionStartAtTime(t *testing.T) {
sc.Publish("foo", data)
}

// Check for illegal configuration
_, err := sc.Subscribe("foo", nil, StartAtTime(time.Time{}))
if err == nil {
t.Fatalf("Expected non-nil error on Subscribe")
}

ch := make(chan bool)
received := int32(0)
shouldReceive := int32(5)
Expand Down Expand Up @@ -678,28 +666,28 @@ func TestSubscriptionStartAtWithEmptyStore(t *testing.T) {
}

sub, err := sc.Subscribe("foo", mcb, StartAtTime(startTime))
if err == nil {
sub.Unsubscribe()
t.Fatalf("Expected error on Subscribe; did not receive one.")
if err != nil {
t.Fatalf("Unexpected error on subscribe: %v", err)
}
sub.Unsubscribe()

sub, err = sc.Subscribe("foo", mcb, StartAtSequence(0))
if err == nil {
sub.Unsubscribe()
t.Fatalf("Expected error on Subscribe; did not recieve one.")
if err != nil {
t.Fatalf("Unexpected error on subscribe: %v", err)
}
sub.Unsubscribe()

sub, err = sc.Subscribe("foo", mcb, StartWithLastReceived())
if err != nil {
t.Fatalf("Expected no error on Subscribe, got %v\n", err)
t.Fatalf("Unexpected error on subscribe: %v", err)
}
sub.Unsubscribe()

sub, err = sc.Subscribe("foo", mcb)
if err != nil {
t.Fatalf("Expected no error on Subscribe, got %v\n", err)
t.Fatalf("Unexpected error on subscribe: %v", err)
}
sub.Unsubscribe()

}

func TestSubscriptionStartAtFirst(t *testing.T) {
Expand Down

0 comments on commit 5acd879

Please sign in to comment.