Skip to content

Commit

Permalink
Remove faulty bulk op timeout tests
Browse files Browse the repository at this point in the history
Motivation
----------
These tests are failing due to issues in the test themselves. Remove
them for now to unblock other changes.

Change-Id: Ic350c77d4be9bafcde4e7b89d2249e4d79f1c441
Reviewed-on: http://review.couchbase.org/113100
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Charles Dixon <chvckd@gmail.com>
  • Loading branch information
chvck committed Aug 8, 2019
1 parent fef4774 commit ad64b72
Showing 1 changed file with 0 additions and 87 deletions.
87 changes: 0 additions & 87 deletions collection_bulk_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package gocb

import (
"context"
"fmt"
"testing"
"time"
)

func TestUpsertGetBulk(t *testing.T) {
Expand Down Expand Up @@ -74,88 +72,3 @@ func TestUpsertGetBulk(t *testing.T) {
}
}
}

func TestBulkUpsertTimeout(t *testing.T) {
var ops []BulkOp
for i := 0; i < 20; i++ {
ops = append(ops, &UpsertOp{
Key: fmt.Sprintf("%d", i),
Value: "test",
Expiry: 20,
})
}

err := globalCollection.Do(ops, &BulkOpOptions{
Timeout: 50 * time.Microsecond,
})
if err == nil {
t.Fatalf("Expected Do to error for upserts")
}

if !IsTimeoutError(err) {
t.Fatalf("Expected Do error to be timeout but was %v", err)
}

for _, op := range ops {
upsertOp, ok := op.(*UpsertOp)
if !ok {
t.Fatalf("Could not type assert BulkOp into UpsertOp")
}

if upsertOp.Err == nil {
t.Fatalf("Expected UpsertOp Err to be not nil")
}

if !IsTimeoutError(upsertOp.Err) {
t.Fatalf("Expected UpsertOp error to be timeout but was %v", upsertOp.Err)
}

if upsertOp.Result != nil {
t.Fatalf("Expected UpsertOp Result to be nil")
}
}
}

func TestBulkUpsertContextTimeout(t *testing.T) {
var ops []BulkOp
for i := 0; i < 20; i++ {
ops = append(ops, &UpsertOp{
Key: fmt.Sprintf("%d", i),
Value: "test",
Expiry: 20,
})
}

ctx, cancel := context.WithTimeout(context.Background(), 50*time.Microsecond)
defer cancel()

err := globalCollection.Do(ops, &BulkOpOptions{
Context: ctx,
})
if err == nil {
t.Fatalf("Expected Do to error for upserts")
}

if !IsTimeoutError(err) {
t.Fatalf("Expected Do error to be timeout but was %v", err)
}

for _, op := range ops {
upsertOp, ok := op.(*UpsertOp)
if !ok {
t.Fatalf("Could not type assert BulkOp into UpsertOp")
}

if upsertOp.Err == nil {
t.Fatalf("Expected UpsertOp Err to be not nil")
}

if !IsTimeoutError(upsertOp.Err) {
t.Fatalf("Expected UpsertOp error to be timeout but was %v", upsertOp.Err)
}

if upsertOp.Result != nil {
t.Fatalf("Expected UpsertOp Result to be nil")
}
}
}

0 comments on commit ad64b72

Please sign in to comment.