use of io.zeebe.containers.ZeebeVolume in project zeebe-test-container by camunda-community-hub.
the class RestartWithExtractedDataExampleTest method shouldGenerateData.
/**
* Start a container with a volume, deploy a process, and extract the generated data to some
* folder. In the next test, we will reuse this data to create a process instance, proving that
* the data was successfully reused.
*
* <p>NOTE: since Zeebe is an asynchronous system, and we cannot guarantee when the engine is
* idle, we stop the container before extracting the data. This causes us to start a second
* (albeit tiny) container to extract the data.
*
* <p>If you all you wanted was to extract data from a live container, then you can use the {@link
* ContainerArchive#builder()} directly and pass in your live container. For such a use case, you
* wouldn't even need to be using a volume.
*/
@Test
@Order(1)
@Timeout(value = 5, unit = TimeUnit.MINUTES)
void shouldGenerateData() throws IOException {
// given
final ZeebeVolume volume = ZeebeVolume.newVolume();
final Path destination = tempDir.resolve(DATA_DIR);
// when
try (final ZeebeContainer container = new ZeebeContainer().withZeebeData(volume)) {
container.start();
deployProcess(container);
}
volume.extract(destination);
// then
assertThat(destination).isNotEmptyDirectory();
}
Aggregations