Skip to content

Commit

Permalink
Merge "[FAB-4621] Modify channel names in tests"
Browse files Browse the repository at this point in the history
  • Loading branch information
hacera-jonathan authored and Gerrit Code Review committed Jun 14, 2017
2 parents 67a4a9e + 84eaca2 commit ad55b06
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
10 changes: 5 additions & 5 deletions orderer/kafka/chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var (
)

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

oldestOffset := int64(0)
newestOffset := int64(5)
Expand Down Expand Up @@ -334,7 +334,7 @@ func TestSetupProducerForChannel(t *testing.T) {
mockBroker := sarama.NewMockBroker(t, 0)
defer mockBroker.Close()

mockChannel := newChannel("channelFoo", defaultPartition)
mockChannel := newChannel("foo.channel", defaultPartition)

haltChan := make(chan struct{})

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

mockChannel := newChannel("channelFoo", defaultPartition)
mockChannel := newChannel("foo.channel", defaultPartition)

oldestOffset := int64(0)
newestOffset := int64(5)
Expand Down Expand Up @@ -410,7 +410,7 @@ func TestSetupConsumerForChannel(t *testing.T) {
}

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

mockSupport := &mockmultichain.ConsenterSupport{
ChainIDVal: mockChannel.topic(),
Expand Down Expand Up @@ -524,7 +524,7 @@ func TestGetLastCutBlockNumber(t *testing.T) {
}

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

testCases := []struct {
Expand Down
4 changes: 2 additions & 2 deletions orderer/kafka/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
)

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

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

Expand Down
4 changes: 2 additions & 2 deletions orderer/kafka/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
)

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

mockBroker := sarama.NewMockBroker(t, 0)
defer func() { mockBroker.Close() }()
Expand Down
3 changes: 1 addition & 2 deletions orderer/kafka/consenter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestHandleChain(t *testing.T) {
newestOffset := int64(5)
message := sarama.StringEncoder("messageFoo")

mockChannel := newChannel("channelFoo", defaultPartition)
mockChannel := newChannel("foo.channel", defaultPartition)

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

Expand Down
2 changes: 1 addition & 1 deletion orderer/kafka/partitioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestStaticPartitioner(t *testing.T) {
var numberOfPartitions int32 = 6

partitionerConstructor := newStaticPartitioner(partition)
partitioner := partitionerConstructor("channelFoo")
partitioner := partitionerConstructor("foo.channel")

for i := 0; i < 10; i++ {
assignedPartition, err := partitioner.Partition(new(sarama.ProducerMessage), numberOfPartitions)
Expand Down
2 changes: 1 addition & 1 deletion orderer/kafka/retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func TestRetry(t *testing.T) {
var rp *retryProcess

mockChannel := newChannel("channelFoo", defaultPartition)
mockChannel := newChannel("foo.channel", defaultPartition)
flag := false

noErrorFn := func() error {
Expand Down

0 comments on commit ad55b06

Please sign in to comment.