use of io.stackgres.common.StackGresContext.LOCK_TIMESTAMP_KEY in project stackgres by ongres.
the class LockAcquirerImplTest method asycRunTaskSuccessfully.
private AtomicBoolean asycRunTaskSuccessfully(int delay) {
AtomicBoolean taskRan = new AtomicBoolean(false);
executorService.execute(() -> lockAcquirer.lockRun(lockRequest, (cluster) -> {
if (delay > 0) {
sleep(delay);
}
StackGresCluster lastPatch = kubeDb.getCluster(clusterName, clusterNamespace);
final Map<String, String> annotations = lastPatch.getMetadata().getAnnotations();
assertEquals(lockRequest.getPodName(), annotations.get(LOCK_POD_KEY), "Task ran without Lock!!");
assertNotNull(annotations.get(LOCK_TIMESTAMP_KEY));
taskRan.set(true);
}));
return taskRan;
}
Aggregations