Skip to content

Commit fe78455

Browse files
improve ExecTest
1 parent 0c4ced3 commit fe78455

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

util/src/test/java/io/kubernetes/client/ExecTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import org.junit.jupiter.api.extension.RegisterExtension;
5353
import org.junit.jupiter.params.ParameterizedTest;
5454
import org.junit.jupiter.params.provider.Arguments;
55-
import org.junit.jupiter.params.provider.CsvSource;
5655
import org.junit.jupiter.params.provider.MethodSource;
5756

5857
import static org.junit.jupiter.params.provider.Arguments.arguments;
@@ -104,7 +103,7 @@ void setup() {
104103

105104
namespace = "default";
106105
podName = "apod";
107-
cmd = new String[] {"cmd1","cmd2"};
106+
cmd = new String[] {"sh", "-c", "echo Hello from inside the pod && ls /tmp"};
108107
}
109108

110109
public static InputStream makeStream(int streamNum, byte[] data) {
@@ -247,8 +246,9 @@ void url() throws IOException, ApiException, InterruptedException {
247246
.withQueryParam("stderr", equalTo("true"))
248247
.withQueryParam("container", equalTo("container"))
249248
.withQueryParam("tty", equalTo("false"))
250-
.withQueryParam("command", equalTo("cmd1"))
251-
.withQueryParam("command", equalTo("cmd2")));
249+
.withQueryParam("command", equalTo("sh"))
250+
.withQueryParam("command", equalTo("-c"))
251+
.withQueryParam("command", equalTo("echo Hello from inside the pod && ls /tmp")));
252252

253253

254254
apiServer.verify(
@@ -259,8 +259,10 @@ void url() throws IOException, ApiException, InterruptedException {
259259
.withQueryParam("stderr", equalTo("false"))
260260
.withQueryParam("container", equalTo("container"))
261261
.withQueryParam("tty", equalTo("false"))
262-
.withQueryParam("command", equalTo("cmd1"))
263-
.withQueryParam("command", equalTo("cmd2")));
262+
.withQueryParam("command", equalTo("sh"))
263+
.withQueryParam("command", equalTo("-c"))
264+
.withQueryParam("command", equalTo("echo Hello from inside the pod && ls /tmp")));
265+
264266

265267
assertThat(p.exitValue()).isEqualTo(EXPECTED_ERROR_EXIT_CODE);
266268
verify(consumer, times(1)).accept(any(Throwable.class));

0 commit comments

Comments
 (0)