@@ -29,7 +29,7 @@ import org.apache.kafka.common.internals.FatalExitError
29
29
import org .apache .kafka .common .utils .Exit
30
30
import org .apache .kafka .network .SocketServerConfigs
31
31
import org .apache .kafka .raft .QuorumConfig
32
- import org .apache .kafka .server .config .{KRaftConfigs , ReplicationConfigs , ZkConfigs }
32
+ import org .apache .kafka .server .config .{KRaftConfigs , ReplicationConfigs }
33
33
import org .junit .jupiter .api .{AfterEach , BeforeEach , Test }
34
34
import org .junit .jupiter .api .Assertions ._
35
35
@@ -47,20 +47,20 @@ class KafkaConfigTest {
47
47
48
48
// We should load configuration file without any arguments
49
49
val config1 = KafkaConfig .fromProps(Kafka .getPropsFromArgs(Array (propertiesFile)))
50
- assertEquals(1 , config1.brokerId )
50
+ assertEquals(1 , config1.nodeId )
51
51
52
52
// We should be able to override given property on command line
53
- val config2 = KafkaConfig .fromProps(Kafka .getPropsFromArgs(Array (propertiesFile, " --override" , " broker .id=2" )))
54
- assertEquals(2 , config2.brokerId )
53
+ val config2 = KafkaConfig .fromProps(Kafka .getPropsFromArgs(Array (propertiesFile, " --override" , " node .id=2" )))
54
+ assertEquals(2 , config2.nodeId )
55
55
56
56
// We should be also able to set completely new property
57
57
val config3 = KafkaConfig .fromProps(Kafka .getPropsFromArgs(Array (propertiesFile, " --override" , " log.cleanup.policy=compact" )))
58
- assertEquals(1 , config3.brokerId )
58
+ assertEquals(1 , config3.nodeId )
59
59
assertEquals(util.Arrays .asList(" compact" ), config3.logCleanupPolicy)
60
60
61
61
// We should be also able to set several properties
62
- val config4 = KafkaConfig .fromProps(Kafka .getPropsFromArgs(Array (propertiesFile, " --override" , " log.cleanup.policy=compact,delete" , " --override" , " broker .id=2" )))
63
- assertEquals(2 , config4.brokerId )
62
+ val config4 = KafkaConfig .fromProps(Kafka .getPropsFromArgs(Array (propertiesFile, " --override" , " log.cleanup.policy=compact,delete" , " --override" , " node .id=2" )))
63
+ assertEquals(2 , config4.nodeId )
64
64
assertEquals(util.Arrays .asList(" compact" ," delete" ), config4.logCleanupPolicy)
65
65
}
66
66
@@ -155,16 +155,6 @@ class KafkaConfigTest {
155
155
|must contain the set of bootstrap controllers or controller.quorum.voters must contain a
156
156
|parseable set of controllers.""" .stripMargin.replace(" \n " , " " )
157
157
)
158
-
159
- // Ensure that if neither process.roles nor controller.quorum.voters is populated, then an exception is thrown if zookeeper.connect is not defined
160
- propertiesFile.setProperty(KRaftConfigs .PROCESS_ROLES_CONFIG , " " )
161
- assertBadConfigContainingMessage(propertiesFile,
162
- " Missing required configuration `zookeeper.connect` which has no default value." )
163
-
164
- // Ensure that no exception is thrown once zookeeper.connect is defined (and we clear controller.listener.names)
165
- propertiesFile.setProperty(ZkConfigs .ZK_CONNECT_CONFIG , " localhost:2181" )
166
- propertiesFile.setProperty(KRaftConfigs .CONTROLLER_LISTENER_NAMES_CONFIG , " " )
167
- KafkaConfig .fromProps(propertiesFile)
168
158
}
169
159
170
160
private def setListenerProps (props : Properties ): Unit = {
@@ -244,7 +234,14 @@ class KafkaConfigTest {
244
234
}
245
235
246
236
def prepareDefaultConfig (): String = {
247
- prepareConfig(Array (" broker.id=1" , " zookeeper.connect=somewhere" ))
237
+ prepareConfig(Array (
238
+ " node.id=1" ,
239
+ " process.roles=controller" ,
240
+ " controller.listener.names=CONTROLLER" ,
241
+ " controller.quorum.voters=1@localhost:9093,2@localhost:9093" ,
242
+ " listeners=CONTROLLER://:9093" ,
243
+ " advertised.listeners=CONTROLLER://127.0.0.1:9093"
244
+ ))
248
245
}
249
246
250
247
def prepareConfig (lines : Array [String ]): String = {
0 commit comments