Skip to content

Commit 9300b14

Browse files
committed
fix
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 6a5643a commit 9300b14

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

Diff for: src/main/java/io/javaoperatorsdk/operator/glue/reconciler/glue/GlueReconciler.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ public DeleteControl cleanup(Glue primary, Context<Glue> context) {
101101
var actualWorkflow = buildWorkflowAndRegisterInformers(primary, context);
102102
var result = actualWorkflow.cleanup(primary, context);
103103
result.throwAggregateExceptionIfErrorsPresent();
104-
105-
if (!result.allPostConditionsMet()) {
104+
if (!result.allPostConditionsMet() && result.getDeleteCalledOnDependents()
105+
.size() < actualWorkflow.getDependentResourcesByName().size()) {
106106
return DeleteControl.noFinalizerRemoval();
107107
} else {
108+
log.debug("All cleanup post conditions met for glue: {} ", primary.getMetadata().getName());
108109
removeFinalizerForParent(primary, context);
109110
actualWorkflow.getDependentResourcesWithoutActivationCondition().forEach(dr -> {
110111
var genericDependentResource = (GenericDependentResource) dr;

Diff for: src/test/java/io/javaoperatorsdk/operator/glue/GlueTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void simpleTemplating() {
6060

6161
delete(glue);
6262

63-
await().timeout(Duration.ofSeconds(30)).untilAsserted(() -> {
63+
await().timeout(GC_TIMEOUT).untilAsserted(() -> {
6464
var cm1 = get(ConfigMap.class, "templconfigmap1");
6565
var cm2 = get(ConfigMap.class, "templconfigmap2");
6666
assertThat(cm1).isNull();
@@ -99,7 +99,7 @@ void crossReferenceResource() {
9999

100100
delete(glue);
101101

102-
await().untilAsserted(() -> {
102+
await().timeout(GC_TIMEOUT).untilAsserted(() -> {
103103
var cm1 = get(ConfigMap.class, "cm-1");
104104
var cm2 = get(ConfigMap.class, "cm-2");
105105
assertThat(cm1).isNull();
@@ -136,7 +136,7 @@ void javaScriptCondition() {
136136

137137
delete(glue);
138138

139-
await().timeout(Duration.ofSeconds(GC_TIMEOUT_SEC)).untilAsserted(() -> {
139+
await().timeout(GC_TIMEOUT).untilAsserted(() -> {
140140
var cm1 = get(ConfigMap.class, "configmap1");
141141
var cm2 = get(ConfigMap.class, "configmap2");
142142
assertThat(cm1).isNull();
@@ -159,7 +159,7 @@ void stringTemplate() {
159159

160160
delete(glue);
161161

162-
await().untilAsserted(() -> {
162+
await().timeout(GC_TIMEOUT).untilAsserted(() -> {
163163
var cm1 = get(ConfigMap.class, "templconfigmap1");
164164
var cm2 = get(ConfigMap.class, "templconfigmap2");
165165
assertThat(cm1).isNull();
@@ -188,7 +188,7 @@ void simpleConcurrencyTest() {
188188
}));
189189

190190
glueList.forEach(this::delete);
191-
await().untilAsserted(() -> IntStream.range(0, num).forEach(index -> {
191+
await().timeout(GC_TIMEOUT).untilAsserted(() -> IntStream.range(0, num).forEach(index -> {
192192
var w = get(Glue.class, "concurrencysample" + index);
193193
assertThat(w).isNull();
194194
}));
@@ -224,7 +224,7 @@ void changingWorkflow() {
224224
glue.getMetadata().setResourceVersion(null);
225225
delete(glue);
226226

227-
await().untilAsserted(() -> {
227+
await().timeout(GC_TIMEOUT).untilAsserted(() -> {
228228
var cm1 = get(ConfigMap.class, "configmap1");
229229
var s = get(Secret.class, "secret1");
230230
assertThat(cm1).isNull();

Diff for: src/test/java/io/javaoperatorsdk/operator/glue/TestBase.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
public class TestBase {
2626

27-
public static final int GC_TIMEOUT_SEC = 45;
27+
public static final int GC_TIMEOUT_SEC = 120;
28+
public static final Duration GC_TIMEOUT = Duration.ofSeconds(GC_TIMEOUT_SEC);
2829

2930
@Inject
3031
protected KubernetesClient client;

0 commit comments

Comments
 (0)