MINOR: update the test.api README.md (#17809)

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
Ken Huang 2024-11-15 16:38:23 +08:00 committed by GitHub
parent ed9cb08dfe
commit 9dc4fca066
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 8 deletions

View File

@ -14,9 +14,12 @@ This annotation has fields for a set of cluster types and number of brokers, as
Arbitrary server properties can also be provided in the annotation: Arbitrary server properties can also be provided in the annotation:
```java ```java
@ClusterTest(types = {Type.KRAFT}, securityProtocol = "PLAINTEXT", properties = { @ClusterTest(
@ClusterProperty(key = "inter.broker.protocol.version", value = "2.7-IV2"), types = {Type.KRAFT},
@ClusterProperty(key = "socket.send.buffer.bytes", value = "10240"), brokerSecurityProtocol = SecurityProtocol.PLAINTEXT,
properties = {
@ClusterProperty(key = "inter.broker.protocol.version", value = "2.7-IV2"),
@ClusterProperty(key = "socket.send.buffer.bytes", value = "10240"),
}) })
void testSomething() { ... } void testSomething() { ... }
``` ```
@ -25,8 +28,8 @@ Multiple `@ClusterTest` annotations can be given to generate more than one test
```scala ```scala
@ClusterTests(Array( @ClusterTests(Array(
@ClusterTest(securityProtocol = "PLAINTEXT"), @ClusterTest(brokerSecurityProtocol = SecurityProtocol.PLAINTEXT),
@ClusterTest(securityProtocol = "SASL_PLAINTEXT") @ClusterTest(securityProtocol = SecurityProtocol.SASL_PLAINTEXT)
)) ))
def testSomething(): Unit = { ... } def testSomething(): Unit = { ... }
``` ```
@ -45,18 +48,18 @@ produce any number of test configurations using a fluent builder style API.
import java.util.Arrays; import java.util.Arrays;
@ClusterTemplate("generateConfigs") @ClusterTemplate("generateConfigs")
void testSomething() { ...} void testSomething() { ... }
static List<ClusterConfig> generateConfigs() { static List<ClusterConfig> generateConfigs() {
ClusterConfig config1 = ClusterConfig.defaultClusterBuilder() ClusterConfig config1 = ClusterConfig.defaultClusterBuilder()
.name("Generated Test 1") .name("Generated Test 1")
.serverProperties(props1) .serverProperties(props1)
.ibp("2.7-IV1") .setMetadataVersion(MetadataVersion.IBP_2_7_IV1)
.build(); .build();
ClusterConfig config2 = ClusterConfig.defaultClusterBuilder() ClusterConfig config2 = ClusterConfig.defaultClusterBuilder()
.name("Generated Test 2") .name("Generated Test 2")
.serverProperties(props2) .serverProperties(props2)
.ibp("2.7-IV2") .setMetadataVersion(MetadataVersion.IBP_2_7_IV2)
.build(); .build();
ClusterConfig config3 = ClusterConfig.defaultClusterBuilder() ClusterConfig config3 = ClusterConfig.defaultClusterBuilder()
.name("Generated Test 3") .name("Generated Test 3")