Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Commit 8a03253

Browse files
authored
fix: no cleanup of config if not updated (#67)
1 parent 81b6727 commit 8a03253

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

core/src/main/java/io/javaoperatorsdk/jenvtest/KubeAPIServer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ public void stop() {
5454
log.debug("Stopping");
5555
kubeApiServerProcess.stopApiServer();
5656
etcdProcess.stopEtcd();
57-
kubeConfig.restoreKubeConfig();
57+
if (config.isUpdateKubeConfig()) {
58+
kubeConfig.restoreKubeConfig();
59+
}
5860
etcdProcess.cleanEtcdData();
5961
log.debug("Stopped");
6062
}

core/src/main/java/io/javaoperatorsdk/jenvtest/process/EtcdProcess.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ public void stopEtcd() {
8888
}
8989
stopped = true;
9090
if (etcdProcess != null) {
91-
etcdProcess.destroyForcibly();
91+
try {
92+
etcdProcess.destroyForcibly();
93+
etcdProcess.waitFor();
94+
} catch (InterruptedException e) {
95+
throw new JenvtestException(e);
96+
}
9297
}
9398
log.debug("etcd stopped");
9499
}

core/src/main/java/io/javaoperatorsdk/jenvtest/process/KubeAPIServerProcess.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ public void waitUntilDefaultNamespaceCreated() {
125125
private boolean ready(HttpClient client, HttpRequest request) {
126126
try {
127127
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
128-
log.trace("Ready Response message:{} code: {}", response.body(), response.statusCode());
128+
log.debug("Ready Response message:{} code: {} Api Server Port: {}", response.body(),
129+
response.statusCode(),
130+
apiServerPort);
129131
return response.statusCode() == 200;
130132
} catch (ConnectException e) {
131133
// still want to retry
@@ -208,7 +210,12 @@ public void stopApiServer() {
208210
}
209211
stopped = true;
210212
if (apiServerProcess != null) {
211-
apiServerProcess.destroyForcibly();
213+
try {
214+
apiServerProcess.destroyForcibly();
215+
apiServerProcess.waitFor();
216+
} catch (InterruptedException e) {
217+
throw new JenvtestException(e);
218+
}
212219
}
213220
log.debug("API Server stopped");
214221
}

0 commit comments

Comments
 (0)