Skip to content

Commit

Permalink
Merge "Enable tests that depended on Go 1.7 functionality"
Browse files Browse the repository at this point in the history
  • Loading branch information
mastersingh24 authored and Gerrit Code Review committed Nov 22, 2016
2 parents 2068322 + 5ce0d90 commit 77c7323
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
9 changes: 6 additions & 3 deletions orderer/kafka/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ limitations under the License.

package kafka

import "testing"
import (
"testing"

"github.com/Shopify/sarama"
)

/* Disabling this until the upgrade to Go 1.7 kicks in
func TestBrokerGetOffset(t *testing.T) {
t.Run("oldest", testBrokerGetOffsetFunc(sarama.OffsetOldest, oldestOffset))
t.Run("newest", testBrokerGetOffsetFunc(sarama.OffsetNewest, newestOffset))
} */
}

func testBrokerGetOffsetFunc(given, expected int64) func(t *testing.T) {
return func(t *testing.T) {
Expand Down
12 changes: 4 additions & 8 deletions orderer/kafka/client_deliver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ import (
ab "github.com/hyperledger/fabric/protos/orderer"
)

/* Disabling this until the upgrade to Go 1.7 kicks in
func TestClientDeliverSeekWrong(t *testing.T) {
t.Run("out-of-range-1", testClientDeliverSeekWrongFunc(uint64(oldestOffset)-1, 10))
t.Run("out-of-range-2", testClientDeliverSeekWrongFunc(uint64(newestOffset), 10))
t.Run("bad-window-1", testClientDeliverSeekWrongFunc(uint64(oldestOffset), 0))
t.Run("bad-window-2", testClientDeliverSeekWrongFunc(uint64(oldestOffset), uint64(testConf.General.MaxWindowSize+1)))
} */
}

func testClientDeliverSeekWrongFunc(seek, window uint64) func(t *testing.T) {
return func(t *testing.T) {
Expand Down Expand Up @@ -64,12 +63,11 @@ func testClientDeliverSeekWrongFunc(seek, window uint64) func(t *testing.T) {
}
}

/* Disabling this until the upgrade to Go 1.7 kicks in
func TestClientDeliverSeek(t *testing.T) {
t.Run("oldest", testClientDeliverSeekFunc("oldest", 0, 10, 10))
t.Run("in-between", testClientDeliverSeekFunc("specific", uint64(middleOffset), 10, 10))
t.Run("newest", testClientDeliverSeekFunc("newest", 0, 10, 1))
} */
}

func testClientDeliverSeekFunc(label string, seek, window uint64, expected int) func(*testing.T) {
return func(t *testing.T) {
Expand Down Expand Up @@ -105,11 +103,10 @@ func testClientDeliverSeekFunc(label string, seek, window uint64, expected int)
}
}

/* Disabling this until the upgrade to Go 1.7 kicks in
func TestClientDeliverAckWrong(t *testing.T) {
t.Run("out-of-range-ack-1", testClientDeliverAckWrongFunc(uint64(middleOffset)-2))
t.Run("out-of-range-ack-2", testClientDeliverAckWrongFunc(uint64(newestOffset)))
} */
}

func testClientDeliverAckWrongFunc(ack uint64) func(t *testing.T) {
return func(t *testing.T) {
Expand Down Expand Up @@ -143,11 +140,10 @@ func testClientDeliverAckWrongFunc(ack uint64) func(t *testing.T) {
}
}

/* Disabling this until the upgrade to Go 1.7 kicks in
func TestClientDeliverAck(t *testing.T) {
t.Run("in-between", testClientDeliverAckFunc("specific", uint64(middleOffset), 10, 10, 2*10))
t.Run("newest", testClientDeliverAckFunc("newest", 0, 10, 1, 1))
} */
}

func testClientDeliverAckFunc(label string, seek, window uint64, threshold, expected int) func(t *testing.T) {
return func(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions orderer/kafka/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ func TestConsumerInitWrong(t *testing.T) {
}
}

/* Disabling this until the upgrade to Go 1.7 kicks in
func TestConsumerRecv(t *testing.T) {
t.Run("oldest", testConsumerRecvFunc(oldestOffset, oldestOffset))
t.Run("in-between", testConsumerRecvFunc(middleOffset, middleOffset))
t.Run("newest", testConsumerRecvFunc(newestOffset-1, newestOffset-1))
} */
}

func testConsumerRecvFunc(given, expected int64) func(t *testing.T) {
return func(t *testing.T) {
Expand Down

0 comments on commit 77c7323

Please sign in to comment.