-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
10871: [Backport stable/8.0] Increase timeout and add logging r=oleschoenburg a=npepinpe # Description Backport of #10868 to `stable/8.1`. relates to #10234 # Conflicts There was a minor conflict in `ClusteringRule` around the logging added, mostly due to the changes we did when we moved the construction of `AtomixCluster` into the dist module. Nothing major, just add to move a line. The PR also backports the `ClusteringRuleExtension`, as it will be useful in the future for more backports, I think. Co-authored-by: Nicolas Pepin-Perreault <nicolas.pepin-perreault@camunda.com>
- Loading branch information
Showing
3 changed files
with
135 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...tegration-tests/src/test/java/io/camunda/zeebe/it/clustering/ClusteringRuleExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.1. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.1. | ||
*/ | ||
package io.camunda.zeebe.it.clustering; | ||
|
||
import io.camunda.zeebe.broker.system.configuration.BrokerCfg; | ||
import io.camunda.zeebe.gateway.impl.configuration.GatewayCfg; | ||
import io.camunda.zeebe.test.util.record.RecordLogger; | ||
import io.camunda.zeebe.test.util.record.RecordingExporter; | ||
import io.camunda.zeebe.util.FileUtil; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.function.Consumer; | ||
import org.junit.jupiter.api.extension.AfterEachCallback; | ||
import org.junit.jupiter.api.extension.BeforeEachCallback; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.junit.jupiter.api.extension.TestWatcher; | ||
|
||
/** This is a wrapper over {@link ClusteringRule}. */ | ||
public class ClusteringRuleExtension extends ClusteringRule | ||
implements BeforeEachCallback, AfterEachCallback, TestWatcher { | ||
|
||
private Path tempDir; | ||
|
||
public ClusteringRuleExtension( | ||
final int partitionCount, | ||
final int replicationFactor, | ||
final int clusterSize, | ||
final Consumer<BrokerCfg> brokerConfigurator, | ||
final Consumer<GatewayCfg> gatewayConfigurator) { | ||
super(partitionCount, replicationFactor, clusterSize, brokerConfigurator, gatewayConfigurator); | ||
} | ||
|
||
@Override | ||
public void afterEach(final ExtensionContext context) throws Exception { | ||
super.after(); | ||
FileUtil.deleteFolderIfExists(tempDir); | ||
} | ||
|
||
@Override | ||
public void beforeEach(final ExtensionContext context) throws Exception { | ||
RecordingExporter.reset(); | ||
tempDir = Files.createTempDirectory("clustered-tests"); | ||
super.before(); | ||
} | ||
|
||
@Override | ||
protected File getBrokerBase(final int nodeId) { | ||
final Path base; | ||
try { | ||
base = tempDir.resolve(String.valueOf(nodeId)); | ||
FileUtil.ensureDirectoryExists(base); | ||
} catch (final IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
return base.toFile(); | ||
} | ||
|
||
public ClusteringRule getCluster() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public void testFailed(final ExtensionContext context, final Throwable cause) { | ||
RecordLogger.logRecords(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters