Skip to content

Commit 5ce0d90

Browse files
author
Kostas Christidis
committed
Enable tests that depended on Go 1.7 functionality
There are several tests in the kafka package that use the t.Run() sub-test functionality. Now that CI runs on Go 1.7 they can be enabled. Change-Id: Ife676941c87952fc14ac750c0a8be414edc13f96 Signed-off-by: Kostas Christidis <kostas@christidis.io>
1 parent 548e9d7 commit 5ce0d90

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

orderer/kafka/broker_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ limitations under the License.
1616

1717
package kafka
1818

19-
import "testing"
19+
import (
20+
"testing"
21+
22+
"github.com/Shopify/sarama"
23+
)
2024

21-
/* Disabling this until the upgrade to Go 1.7 kicks in
2225
func TestBrokerGetOffset(t *testing.T) {
2326
t.Run("oldest", testBrokerGetOffsetFunc(sarama.OffsetOldest, oldestOffset))
2427
t.Run("newest", testBrokerGetOffsetFunc(sarama.OffsetNewest, newestOffset))
25-
} */
28+
}
2629

2730
func testBrokerGetOffsetFunc(given, expected int64) func(t *testing.T) {
2831
return func(t *testing.T) {

orderer/kafka/client_deliver_test.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@ import (
2323
ab "github.com/hyperledger/fabric/protos/orderer"
2424
)
2525

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

3433
func testClientDeliverSeekWrongFunc(seek, window uint64) func(t *testing.T) {
3534
return func(t *testing.T) {
@@ -64,12 +63,11 @@ func testClientDeliverSeekWrongFunc(seek, window uint64) func(t *testing.T) {
6463
}
6564
}
6665

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

7472
func testClientDeliverSeekFunc(label string, seek, window uint64, expected int) func(*testing.T) {
7573
return func(t *testing.T) {
@@ -105,11 +103,10 @@ func testClientDeliverSeekFunc(label string, seek, window uint64, expected int)
105103
}
106104
}
107105

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

114111
func testClientDeliverAckWrongFunc(ack uint64) func(t *testing.T) {
115112
return func(t *testing.T) {
@@ -143,11 +140,10 @@ func testClientDeliverAckWrongFunc(ack uint64) func(t *testing.T) {
143140
}
144141
}
145142

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

152148
func testClientDeliverAckFunc(label string, seek, window uint64, threshold, expected int) func(t *testing.T) {
153149
return func(t *testing.T) {

orderer/kafka/consumer_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ func TestConsumerInitWrong(t *testing.T) {
3030
}
3131
}
3232

33-
/* Disabling this until the upgrade to Go 1.7 kicks in
3433
func TestConsumerRecv(t *testing.T) {
3534
t.Run("oldest", testConsumerRecvFunc(oldestOffset, oldestOffset))
3635
t.Run("in-between", testConsumerRecvFunc(middleOffset, middleOffset))
3736
t.Run("newest", testConsumerRecvFunc(newestOffset-1, newestOffset-1))
38-
} */
37+
}
3938

4039
func testConsumerRecvFunc(given, expected int64) func(t *testing.T) {
4140
return func(t *testing.T) {

0 commit comments

Comments
 (0)