|
28 | 28 | import java.util.List; |
29 | 29 | import java.util.Objects; |
30 | 30 | import java.util.Optional; |
31 | | -import java.util.concurrent.TimeUnit; |
32 | 31 |
|
33 | 32 | import com.github.dockerjava.api.command.ListImagesCmd; |
34 | 33 | import com.github.dockerjava.api.command.PullImageCmd; |
35 | 34 | import com.github.dockerjava.api.command.SaveImageCmd; |
36 | 35 | import com.github.dockerjava.api.model.Image; |
37 | 36 | import org.apache.commons.logging.Log; |
38 | 37 | import org.apache.commons.logging.LogFactory; |
39 | | -import org.assertj.core.api.Assertions; |
40 | 38 | import org.testcontainers.containers.Container; |
41 | 39 | import org.testcontainers.k3s.K3sContainer; |
42 | 40 | import reactor.netty.http.client.HttpClient; |
@@ -79,54 +77,6 @@ public static void loadSpringCloudKubernetesImage(String project, K3sContainer c |
79 | 77 | loadImage("springcloud/" + project, pomVersion(), project, container); |
80 | 78 | } |
81 | 79 |
|
82 | | - /** |
83 | | - * assert that "left" is present and if so, "right" is not. |
84 | | - */ |
85 | | - public static void assertReloadLogStatements(String left, String right, String appLabel) { |
86 | | - |
87 | | - try { |
88 | | - String appPodName = CONTAINER |
89 | | - .execInContainer("sh", "-c", |
90 | | - "kubectl get pods -l app=" + appLabel + " -o=name --no-headers | tr -d '\n'") |
91 | | - .getStdout(); |
92 | | - LOG.info("appPodName : ->" + appPodName + "<-"); |
93 | | - // we issue a pollDelay to let the logs sync in, otherwise the results are not |
94 | | - // going to be correctly asserted |
95 | | - await().pollDelay(20, TimeUnit.SECONDS) |
96 | | - .pollInterval(Duration.ofSeconds(5)) |
97 | | - .atMost(Duration.ofSeconds(120)) |
98 | | - .until(() -> { |
99 | | - |
100 | | - Container.ExecResult result = CONTAINER.execInContainer("sh", "-c", |
101 | | - "kubectl logs " + appPodName.trim() + "| grep " + "'" + left + "'"); |
102 | | - String error = result.getStderr(); |
103 | | - String ok = result.getStdout(); |
104 | | - |
105 | | - LOG.info("error is : -->" + error + "<--"); |
106 | | - |
107 | | - if (ok != null && !ok.isBlank()) { |
108 | | - |
109 | | - if (!right.isBlank()) { |
110 | | - String notPresent = CONTAINER |
111 | | - .execInContainer("sh", "-c", |
112 | | - "kubectl logs " + appPodName.trim() + "| grep " + "'" + right + "'") |
113 | | - .getStdout(); |
114 | | - |
115 | | - Assertions.assertThat(notPresent).isNullOrEmpty(); |
116 | | - } |
117 | | - |
118 | | - return true; |
119 | | - } |
120 | | - LOG.info("log statement not yet present"); |
121 | | - return false; |
122 | | - }); |
123 | | - } |
124 | | - catch (Exception e) { |
125 | | - throw new RuntimeException(e); |
126 | | - } |
127 | | - |
128 | | - } |
129 | | - |
130 | 80 | /** |
131 | 81 | * create a tar, copy it in the running k3s and load this tar as an image. |
132 | 82 | */ |
|
0 commit comments