use of org.apache.flink.test.util.MiniClusterWithClientResource in project flink by apache.
the class NettyEpollITCase method trySetUpCluster.
private MiniClusterWithClientResource trySetUpCluster() throws Exception {
try {
Configuration config = new Configuration();
config.setString(NettyShuffleEnvironmentOptions.TRANSPORT_TYPE, "epoll");
MiniClusterWithClientResource cluster = new MiniClusterWithClientResource(new MiniClusterResourceConfiguration.Builder().setConfiguration(config).setNumberTaskManagers(NUM_TASK_MANAGERS).setNumberSlotsPerTaskManager(1).build());
cluster.before();
return cluster;
} catch (UnsatisfiedLinkError ex) {
// If we failed to init netty because we are not on Linux platform, abort the test.
if (findThrowableWithMessage(ex, "Only supported on Linux").isPresent()) {
throw new AssumptionViolatedException("This test is only supported on linux");
}
throw ex;
}
}
use of org.apache.flink.test.util.MiniClusterWithClientResource in project flink by apache.
the class ChangelogCompatibilityITCase method before.
@Before
public void before() throws Exception {
checkpointDir = TEMPORARY_FOLDER.newFolder();
savepointDir = TEMPORARY_FOLDER.newFolder();
Configuration config = new Configuration();
config.setString(CHECKPOINTS_DIRECTORY, pathToString(checkpointDir));
config.setString(SAVEPOINT_DIRECTORY, pathToString(savepointDir));
FsStateChangelogStorageFactory.configure(config, TEMPORARY_FOLDER.newFolder());
miniClusterResource = new MiniClusterWithClientResource(new MiniClusterResourceConfiguration.Builder().setConfiguration(config).setNumberTaskManagers(11).setNumberSlotsPerTaskManager(1).build());
miniClusterResource.before();
}
use of org.apache.flink.test.util.MiniClusterWithClientResource in project flink by apache.
the class UnalignedCheckpointStressITCase method setup.
@Before
public void setup() throws Exception {
Configuration configuration = new Configuration();
File folder = temporaryFolder.getRoot();
configuration.set(CHECKPOINTS_DIRECTORY, folder.toURI().toString());
configuration.set(MAX_RETAINED_CHECKPOINTS, 1);
// Configure DFS DSTL for this test as it might produce too much GC pressure if
// ChangelogStateBackend is used.
// Doing it on cluster level unconditionally as randomization currently happens on the job
// level (environment); while this factory can only be set on the cluster level.
FsStateChangelogStorageFactory.configure(configuration, changelogFolder.newFolder());
cluster = new MiniClusterWithClientResource(new MiniClusterResourceConfiguration.Builder().setConfiguration(configuration).setNumberTaskManagers(NUM_TASK_MANAGERS).setNumberSlotsPerTaskManager(NUM_TASK_SLOTS).build());
cluster.before();
}
use of org.apache.flink.test.util.MiniClusterWithClientResource in project flink by apache.
the class RegionFailoverITCase method setup.
@Before
public void setup() throws Exception {
Configuration configuration = new Configuration();
configuration.setString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY, "region");
configuration.setString(HighAvailabilityOptions.HA_MODE, TestingHAFactory.class.getName());
cluster = new MiniClusterWithClientResource(new MiniClusterResourceConfiguration.Builder().setConfiguration(configuration).setNumberTaskManagers(2).setNumberSlotsPerTaskManager(2).build());
cluster.before();
jobFailedCnt.set(0);
numCompletedCheckpoints.set(0);
}
use of org.apache.flink.test.util.MiniClusterWithClientResource in project flink by apache.
the class SavepointFormatITCase method testTriggerSavepointAndResumeWithFileBasedCheckpointsAndRelocateBasePath.
@ParameterizedTest(name = "[{index}] {0}, {1}")
@MethodSource("parameters")
public void testTriggerSavepointAndResumeWithFileBasedCheckpointsAndRelocateBasePath(SavepointFormatType formatType, StateBackendConfig stateBackendConfig) throws Exception {
final int numTaskManagers = 2;
final int numSlotsPerTaskManager = 2;
final Configuration config = stateBackendConfig.getConfiguration();
config.set(CheckpointingOptions.CHECKPOINTS_DIRECTORY, checkpointsDir.toUri().toString());
final MiniClusterWithClientResource miniClusterResource = new MiniClusterWithClientResource(new MiniClusterResourceConfiguration.Builder().setConfiguration(config).setNumberTaskManagers(numTaskManagers).setNumberSlotsPerTaskManager(numSlotsPerTaskManager).build());
miniClusterResource.before();
try {
final String savepointPath = submitJobAndTakeSavepoint(miniClusterResource, formatType, stateBackendConfig.getCheckpointsBeforeSavepoint(), config);
final CheckpointMetadata metadata = loadCheckpointMetadata(savepointPath);
final OperatorState operatorState = metadata.getOperatorStates().stream().filter(hasKeyedState()).findFirst().get();
operatorState.getStates().stream().flatMap(subtaskState -> subtaskState.getManagedKeyedState().stream()).forEach(handle -> validateState(handle, formatType, stateBackendConfig));
relocateAndVerify(miniClusterResource, savepointPath, renamedSavepointDir, config);
} finally {
miniClusterResource.after();
}
}
Aggregations