Skip to content

Commit

Permalink
MINOR: update the test.api README.md (#17809)
Browse files Browse the repository at this point in the history
Reviewers: Chia-Ping Tsai <[email protected]>
  • Loading branch information
m1a2st authored Nov 15, 2024
1 parent ed9cb08 commit 9dc4fca
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:

```java
@ClusterTest(types = {Type.KRAFT}, securityProtocol = "PLAINTEXT", properties = {
@ClusterProperty(key = "inter.broker.protocol.version", value = "2.7-IV2"),
@ClusterProperty(key = "socket.send.buffer.bytes", value = "10240"),
@ClusterTest(
types = {Type.KRAFT},
brokerSecurityProtocol = SecurityProtocol.PLAINTEXT,
properties = {
@ClusterProperty(key = "inter.broker.protocol.version", value = "2.7-IV2"),
@ClusterProperty(key = "socket.send.buffer.bytes", value = "10240"),
})
void testSomething() { ... }
```
Expand All @@ -25,8 +28,8 @@ Multiple `@ClusterTest` annotations can be given to generate more than one test

```scala
@ClusterTests(Array(
@ClusterTest(securityProtocol = "PLAINTEXT"),
@ClusterTest(securityProtocol = "SASL_PLAINTEXT")
@ClusterTest(brokerSecurityProtocol = SecurityProtocol.PLAINTEXT),
@ClusterTest(securityProtocol = SecurityProtocol.SASL_PLAINTEXT)
))
def testSomething(): Unit = { ... }
```
Expand All @@ -45,18 +48,18 @@ produce any number of test configurations using a fluent builder style API.
import java.util.Arrays;

@ClusterTemplate("generateConfigs")
void testSomething() { ...}
void testSomething() { ... }

static List<ClusterConfig> generateConfigs() {
ClusterConfig config1 = ClusterConfig.defaultClusterBuilder()
.name("Generated Test 1")
.serverProperties(props1)
.ibp("2.7-IV1")
.setMetadataVersion(MetadataVersion.IBP_2_7_IV1)
.build();
ClusterConfig config2 = ClusterConfig.defaultClusterBuilder()
.name("Generated Test 2")
.serverProperties(props2)
.ibp("2.7-IV2")
.setMetadataVersion(MetadataVersion.IBP_2_7_IV2)
.build();
ClusterConfig config3 = ClusterConfig.defaultClusterBuilder()
.name("Generated Test 3")
Expand Down

0 comments on commit 9dc4fca

Please sign in to comment.