use of org.eclipse.jkube.kit.build.service.docker.watch.WatchContext in project jkube by eclipse.
the class WatchServiceTest method testCopyFilesToContainer.
@Test
public void testCopyFilesToContainer() throws Exception {
// Given
AtomicBoolean fileCopied = new AtomicBoolean(false);
WatchContext watchContext = WatchContext.builder().watchMode(WatchMode.copy).containerCopyTask(f -> fileCopied.compareAndSet(false, true)).build();
File fileToCopy = Files.createTempFile("test-changed-files", "tar").toFile();
WatchService.ImageWatcher imageWatcher = new WatchService.ImageWatcher(imageConfiguration, watchContext, "test-img", "efe1234");
WatchService watchService = new WatchService(archiveService, buildService, queryService, runService, logger);
// When
watchService.copyFilesToContainer(fileToCopy, imageWatcher);
// Then
assertTrue(fileCopied.get());
}
use of org.eclipse.jkube.kit.build.service.docker.watch.WatchContext in project jkube by eclipse.
the class WatchServiceTest method testCallPostExec.
@Test
public void testCallPostExec() throws Exception {
// Given
AtomicBoolean postExecCommandExecuted = new AtomicBoolean(false);
WatchContext watchContext = WatchContext.builder().watchMode(WatchMode.copy).containerCommandExecutor(imageWatcher -> {
postExecCommandExecuted.set(true);
return "Some Output";
}).build();
WatchService.ImageWatcher imageWatcher = new WatchService.ImageWatcher(imageConfiguration, watchContext, "test-img", "efe1234");
WatchService watchService = new WatchService(archiveService, buildService, queryService, runService, logger);
// When
watchService.callPostExec(imageWatcher);
// Then
assertTrue(postExecCommandExecuted.get());
}
Aggregations