mirror of https://github.com/apache/kafka.git
KAFKA-16435 Add test for KAFKA-16428 (#15635)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
parent
a524b6217b
commit
cc6b919212
|
|
@ -40,9 +40,10 @@ import org.apache.kafka.metadata.migration.ZkMigrationLeadershipState
|
|||
import org.apache.kafka.server.common.ApiMessageAndVersion
|
||||
import org.apache.kafka.server.config.ConfigType
|
||||
import org.apache.kafka.server.util.MockRandom
|
||||
import org.junit.jupiter.api.Assertions.{assertEquals, assertTrue, fail}
|
||||
import org.junit.jupiter.api.Assertions.{assertEquals, assertFalse, assertTrue, fail}
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import java.nio.charset.StandardCharsets.UTF_8
|
||||
import java.util
|
||||
import java.util.Properties
|
||||
import scala.collection.Map
|
||||
|
|
@ -112,10 +113,20 @@ class ZkConfigMigrationClientTest extends ZkMigrationTestHarness {
|
|||
assertEquals(newProps.get(key), value)
|
||||
}
|
||||
}
|
||||
assertPathExistenceAndData("/config/changes/config_change_0000000000", """{"version":2,"entity_path":"brokers/1"}""")
|
||||
|
||||
migrationState = migrationClient.configClient().deleteConfigs(
|
||||
new ConfigResource(ConfigResource.Type.BROKER, "1"), migrationState)
|
||||
assertEquals(0, zkClient.getEntityConfigs(ConfigType.BROKER, "1").size())
|
||||
assertPathExistenceAndData("/config/changes/config_change_0000000001", """{"version":2,"entity_path":"brokers/1"}""")
|
||||
|
||||
// make sure there is no more config change notification in znode
|
||||
assertFalse(zkClient.pathExists("/config/changes/config_change_0000000002"))
|
||||
}
|
||||
|
||||
private def assertPathExistenceAndData(expectedPath: String, data: String): Unit = {
|
||||
assertTrue(zkClient.pathExists(expectedPath))
|
||||
assertEquals(Some(data), zkClient.getDataAndStat(expectedPath)._1.map(new String(_, UTF_8)))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue