mynameborat commented on a change in pull request #951: SAMZA-2127: Upgrade to
Kafka 2.0
URL: https://github.com/apache/samza/pull/951#discussion_r269749949
##########
File path:
samza-kafka/src/test/scala/org/apache/samza/system/kafka/TestKafkaSystemAdmin.scala
##########
@@ -169,59 +165,21 @@ class TestKafkaSystemAdmin {
import TestKafkaSystemAdmin._
- @Test
- def testShouldAssembleMetadata {
- val oldestOffsets = Map(
- new SystemStreamPartition(SYSTEM, "stream1", new Partition(0)) -> "o1",
- new SystemStreamPartition(SYSTEM, "stream2", new Partition(0)) -> "o2",
- new SystemStreamPartition(SYSTEM, "stream1", new Partition(1)) -> "o3",
- new SystemStreamPartition(SYSTEM, "stream2", new Partition(1)) -> "o4")
- val newestOffsets = Map(
- new SystemStreamPartition(SYSTEM, "stream1", new Partition(0)) -> "n1",
- new SystemStreamPartition(SYSTEM, "stream2", new Partition(0)) -> "n2",
- new SystemStreamPartition(SYSTEM, "stream1", new Partition(1)) -> "n3",
- new SystemStreamPartition(SYSTEM, "stream2", new Partition(1)) -> "n4")
- val upcomingOffsets = Map(
- new SystemStreamPartition(SYSTEM, "stream1", new Partition(0)) -> "u1",
- new SystemStreamPartition(SYSTEM, "stream2", new Partition(0)) -> "u2",
- new SystemStreamPartition(SYSTEM, "stream1", new Partition(1)) -> "u3",
- new SystemStreamPartition(SYSTEM, "stream2", new Partition(1)) -> "u4")
- val metadata = KafkaSystemAdminUtilsScala.assembleMetadata(oldestOffsets,
newestOffsets, upcomingOffsets)
- assertNotNull(metadata)
- assertEquals(2, metadata.size)
- assertTrue(metadata.contains("stream1"))
- assertTrue(metadata.contains("stream2"))
- val stream1Metadata = metadata("stream1")
- val stream2Metadata = metadata("stream2")
- assertNotNull(stream1Metadata)
- assertNotNull(stream2Metadata)
- assertEquals("stream1", stream1Metadata.getStreamName)
- assertEquals("stream2", stream2Metadata.getStreamName)
- val expectedSystemStream1Partition0Metadata = new
SystemStreamPartitionMetadata("o1", "n1", "u1")
- val expectedSystemStream1Partition1Metadata = new
SystemStreamPartitionMetadata("o3", "n3", "u3")
- val expectedSystemStream2Partition0Metadata = new
SystemStreamPartitionMetadata("o2", "n2", "u2")
- val expectedSystemStream2Partition1Metadata = new
SystemStreamPartitionMetadata("o4", "n4", "u4")
- val stream1PartitionMetadata =
stream1Metadata.getSystemStreamPartitionMetadata
- val stream2PartitionMetadata =
stream2Metadata.getSystemStreamPartitionMetadata
- assertEquals(expectedSystemStream1Partition0Metadata,
stream1PartitionMetadata.get(new Partition(0)))
- assertEquals(expectedSystemStream1Partition1Metadata,
stream1PartitionMetadata.get(new Partition(1)))
- assertEquals(expectedSystemStream2Partition0Metadata,
stream2PartitionMetadata.get(new Partition(0)))
- assertEquals(expectedSystemStream2Partition1Metadata,
stream2PartitionMetadata.get(new Partition(1)))
- }
-
@Test
def testShouldGetOldestNewestAndNextOffsets {
- // Create an empty topic with 50 partitions, but with no offsets.
- createTopic(TOPIC, 50)
- validateTopic(TOPIC, 50)
+ // Reduced the partition count to 25 instead of 50 to prevent tests from
failing. In the current setup,
Review comment:
Discussed offline. The essence of the tests remains the same except the
higher number of partitions doesn't play well with the current Embedded Kafka
setup (3 brokers) in terms of replication assignment especially with the new
create APIs which used in the tests which use RackAwareMode as Enforced by
default.
I didn't want to spend too much time on getting it to work since the essence
of the tests still remains the same.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services