Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

10 changes: 5 additions & 5 deletions storage/src/test/java/org/apache/kafka/tiered/storage/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# The Test Flow

Step 1: For every test, setup is done via TieredStorageTestHarness which extends IntegrationTestHarness and sets up a cluster with TS enabled on it.
Step 1: Each test is a standalone class. It declares a `clusterConfig()` method that returns a `ClusterConfig` with tiered storage enabled (via `TieredStorageTestUtils.createServerPropsForRemoteStorage`), and test methods annotated with `@ClusterTemplate("clusterConfig")` that receive a `ClusterInstance` provided by the test framework.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The current wording says clusterConfig() returns a ClusterConfig, but the tiered storage tests generally return List<ClusterConfig> from their @ClusterTemplate methods. Could we make this slightly more precise, e.g. “returns one or more ClusterConfig instances, typically as List<ClusterConfig>”?


Step 2: The test is written as a specification consisting of sequential actions and assertions. The spec for the complete test is written down first which creates "actions" to be executed.
Step 2: The test is written as a specification consisting of sequential actions and assertions. The spec for the complete test is built first using `TieredStorageTestBuilder`, which creates the "actions" to be executed.

Step 3: Once we have the test spec in-place (which includes assertion actions), we execute the test which will execute each action sequentially.
Step 3: A `TieredStorageTestContext` is created from the `ClusterInstance` (plus any extra consumer config). The test is then executed by running each action of the spec sequentially against the context.

Step 4: The test execution stops when any of the action throws an exception (or an assertion error).
Step 4: The test execution stops when any of the actions throws an exception (or an assertion error).

Step 5: Clean-up for the test is performed on test exit
Step 5: Clean-up for the test is performed on test exit — the `TieredStorageTestContext` is closed (it is `AutoCloseable`, typically via try-with-resources) and the test report is printed.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.apache.kafka.tiered.storage.specs.ExpandPartitionCountSpec;
import org.apache.kafka.tiered.storage.specs.TopicSpec;
import org.apache.kafka.tiered.storage.utils.BrokerLocalStorage;
import org.apache.kafka.tiered.storage.utils.TieredStorageTestUtils;

import java.io.FilenameFilter;
import java.io.IOException;
Expand Down Expand Up @@ -104,8 +105,8 @@ private void initClients() {
}

private void initContext() {
remoteStorageManagers = TieredStorageTestHarness.remoteStorageManagers(cluster.aliveBrokers().values());
localStorages = TieredStorageTestHarness.localStorages(cluster.aliveBrokers().values());
remoteStorageManagers = TieredStorageTestUtils.remoteStorageManagers(cluster.aliveBrokers().values());
localStorages = TieredStorageTestUtils.localStorages(cluster.aliveBrokers().values());
}

public void createTopic(TopicSpec spec) throws ExecutionException, InterruptedException {
Expand Down Expand Up @@ -260,7 +261,7 @@ public void eraseBrokerStorage(int brokerId,
boolean isStopped) throws IOException {
BrokerLocalStorage brokerLocalStorage;
if (isStopped) {
brokerLocalStorage = TieredStorageTestHarness.localStorages(cluster.brokers().values())
brokerLocalStorage = TieredStorageTestUtils.localStorages(cluster.brokers().values())
.stream()
.filter(bls -> bls.getBrokerId() == brokerId)
.findFirst()
Expand Down
Loading
Loading