plugins/arrow-flight-rpc/docs/chaos.md
The Arrow Flight RPC plugin includes chaos testing capabilities to simulate network failures and test resilience.
Chaos testing is disabled by default. To enable it, modify the build.gradle file:
Add this to the internalClusterTest task:
internalClusterTest {
// Enable chaos testing via bytecode injection
doFirst {
def agentJar = createChaosAgent()
jvmArgs "-javaagent:${agentJar}"
}
}
Add this task to create the chaos agent JAR:
// Task to create chaos agent JAR
def createChaosAgent() {
def agentJar = file("${buildDir}/chaos-agent.jar")
if (!agentJar.exists()) {
def manifestFile = file("${buildDir}/MANIFEST.MF")
manifestFile.text = '''Manifest-Version: 1.0
Premain-Class: org.opensearch.arrow.flight.chaos.ChaosAgent
Agent-Class: org.opensearch.arrow.flight.chaos.ChaosAgent
Can-Redefine-Classes: true
Can-Retransform-Classes: true
'''
ant.jar(destfile: agentJar, manifest: manifestFile) {
fileset(dir: sourceSets.internalClusterTest.output.classesDirs.first(), includes: 'org/opensearch/arrow/flight/chaos/ChaosAgent*.class')
}
}
return agentJar.absolutePath
}
Once enabled, run the chaos tests with:
./gradlew :plugins:arrow-flight-rpc:internalClusterTest --tests="*Chaos*"
The chaos testing framework: