Skip to content

Commit 84eaca2

Browse files
committed
[FAB-4621] Modify channel names in tests
With FAB-2487 in, uppercase characters are no longer allowed in channel names. This doesn't affect the channel names we use in our tests since they do not go through the validate function that was modified in FAB-2487, but we should give them valid names nonetheless for consistency. This changeset does the necessary modifications. Change-Id: Id3d02138b5c767ad1fd560e387caaadd6bafa2d6 Signed-off-by: Kostas Christidis <[email protected]>
1 parent 56667c1 commit 84eaca2

6 files changed

+12
-13
lines changed

orderer/kafka/chain_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var (
3131
)
3232

3333
func TestChain(t *testing.T) {
34-
mockChannel := newChannel("channelFoo", defaultPartition)
34+
mockChannel := newChannel("foo.channel", defaultPartition)
3535

3636
oldestOffset := int64(0)
3737
newestOffset := int64(5)
@@ -334,7 +334,7 @@ func TestSetupProducerForChannel(t *testing.T) {
334334
mockBroker := sarama.NewMockBroker(t, 0)
335335
defer mockBroker.Close()
336336

337-
mockChannel := newChannel("channelFoo", defaultPartition)
337+
mockChannel := newChannel("foo.channel", defaultPartition)
338338

339339
haltChan := make(chan struct{})
340340

@@ -359,7 +359,7 @@ func TestSetupConsumerForChannel(t *testing.T) {
359359
mockBroker := sarama.NewMockBroker(t, 0)
360360
defer func() { mockBroker.Close() }()
361361

362-
mockChannel := newChannel("channelFoo", defaultPartition)
362+
mockChannel := newChannel("foo.channel", defaultPartition)
363363

364364
oldestOffset := int64(0)
365365
newestOffset := int64(5)
@@ -410,7 +410,7 @@ func TestSetupConsumerForChannel(t *testing.T) {
410410
}
411411

412412
func TestCloseKafkaObjects(t *testing.T) {
413-
mockChannel := newChannel("channelFoo", defaultPartition)
413+
mockChannel := newChannel("foo.channel", defaultPartition)
414414

415415
mockSupport := &mockmultichain.ConsenterSupport{
416416
ChainIDVal: mockChannel.topic(),
@@ -524,7 +524,7 @@ func TestGetLastCutBlockNumber(t *testing.T) {
524524
}
525525

526526
func TestGetLastOffsetPersisted(t *testing.T) {
527-
mockChannel := newChannel("channelFoo", defaultPartition)
527+
mockChannel := newChannel("foo.channel", defaultPartition)
528528
mockMetadata := &cb.Metadata{Value: utils.MarshalOrPanic(&ab.KafkaMetadata{LastOffsetPersisted: int64(5)})}
529529

530530
testCases := []struct {

orderer/kafka/channel_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import (
2424
)
2525

2626
func TestChannel(t *testing.T) {
27-
chn := newChannel("channelFoo", defaultPartition)
27+
chn := newChannel("foo.channel", defaultPartition)
2828

29-
expectedTopic := fmt.Sprintf("%s", "channelFoo")
29+
expectedTopic := fmt.Sprintf("%s", "foo.channel")
3030
actualTopic := chn.topic()
3131
assert.Equal(t, expectedTopic, actualTopic, "Got the wrong topic, expected %s, got %s instead", expectedTopic, actualTopic)
3232

orderer/kafka/config_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import (
1717
)
1818

1919
func TestBrokerConfig(t *testing.T) {
20-
mockChannel1 := newChannel("channelFoo", defaultPartition)
20+
mockChannel1 := newChannel("foo.channel", defaultPartition)
2121
// Use a partition ID that is not the 'default' (defaultPartition)
2222
var differentPartition int32 = defaultPartition + 1
23-
mockChannel2 := newChannel("channelFoo", differentPartition)
23+
mockChannel2 := newChannel("foo.channel", differentPartition)
2424

2525
mockBroker := sarama.NewMockBroker(t, 0)
2626
defer func() { mockBroker.Close() }()

orderer/kafka/consenter_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func TestHandleChain(t *testing.T) {
6767
newestOffset := int64(5)
6868
message := sarama.StringEncoder("messageFoo")
6969

70-
mockChannel := newChannel("channelFoo", defaultPartition)
70+
mockChannel := newChannel("foo.channel", defaultPartition)
7171

7272
mockBroker := sarama.NewMockBroker(t, 0)
7373
mockBroker.SetHandlerByMap(map[string]sarama.MockResponse{
@@ -113,7 +113,6 @@ func extractEncodedOffset(marshalledOrdererMetadata []byte) int64 {
113113
func newMockBrokerConfig(tlsConfig localconfig.TLS, retryOptions localconfig.Retry, kafkaVersion sarama.KafkaVersion, chosenStaticPartition int32) *sarama.Config {
114114
brokerConfig := newBrokerConfig(tlsConfig, retryOptions, kafkaVersion, chosenStaticPartition)
115115
brokerConfig.ClientID = "test"
116-
brokerConfig.Producer.MaxMessageBytes-- // FIXME https://jira.hyperledger.org/browse/FAB-4083
117116
return brokerConfig
118117
}
119118

orderer/kafka/partitioner_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestStaticPartitioner(t *testing.T) {
1818
var numberOfPartitions int32 = 6
1919

2020
partitionerConstructor := newStaticPartitioner(partition)
21-
partitioner := partitionerConstructor("channelFoo")
21+
partitioner := partitionerConstructor("foo.channel")
2222

2323
for i := 0; i < 10; i++ {
2424
assignedPartition, err := partitioner.Partition(new(sarama.ProducerMessage), numberOfPartitions)

orderer/kafka/retry_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
func TestRetry(t *testing.T) {
1717
var rp *retryProcess
1818

19-
mockChannel := newChannel("channelFoo", defaultPartition)
19+
mockChannel := newChannel("foo.channel", defaultPartition)
2020
flag := false
2121

2222
noErrorFn := func() error {

0 commit comments

Comments
 (0)