sashapolo commented on a change in pull request #647:
URL: https://github.com/apache/ignite-3/pull/647#discussion_r803386862
##########
File path:
modules/cli/src/test/java/org/apache/ignite/cli/IgniteCliInterfaceTest.java
##########
@@ -581,17 +619,200 @@ void setJson() throws IOException, InterruptedException {
+ "local.baseline.autoAdjust.enabled=true --type
node"
).split(" "));
- Assertions.assertEquals(0, exitCode);
- verify(httpClient).send(
- argThat(r ->
"http://localhost:8081/management/v1/configuration/node/".equals(r.uri().toString())
- && "PATCH".equals(r.method())
- && r.bodyPublisher().get().contentLength() ==
expSentContent.getBytes(UTF_8).length
- &&
"application/json".equals(r.headers().firstValue("Content-Type").get())),
- any());
- assertEquals("Configuration was updated successfully.\n\n"
+ assertThatExitCodeMeansSuccess(exitCode);
+
+ verify(httpClient).send(requestCaptor.capture(), any());
+ HttpRequest capturedRequest = requestCaptor.getValue();
+
+ assertThat(capturedRequest.uri().toString(),
is("http://localhost:8081/management/v1/configuration/node/"));
+ assertThat(capturedRequest.method(), is("PATCH"));
+ assertThat(requestBodyBytes(capturedRequest),
is(expSentContent.getBytes(UTF_8)));
+ assertThat(capturedRequest.headers().firstValue("Content-Type"),
isPresentAnd(is("application/json")));
+
+ assertOutputEqual("Configuration was updated successfully.\n\n"
+ "Use the " + cmd.getColorScheme().commandText("ignite
config get")
- + " command to view the updated configuration.\n",
out.toString());
+ + " command to view the updated configuration.\n",
out.toString(UTF_8));
+ assertThatStderrIsEmpty();
+ }
+ }
+
+ /**
+ * Tests "cluster" command.
+ */
+ @Nested
+ @DisplayName("cluster")
+ class Cluster {
Review comment:
a ticket seems fine
##########
File path:
modules/cli/src/test/java/org/apache/ignite/cli/IgniteCliInterfaceTest.java
##########
@@ -581,17 +619,200 @@ void setJson() throws IOException, InterruptedException {
+ "local.baseline.autoAdjust.enabled=true --type
node"
).split(" "));
- Assertions.assertEquals(0, exitCode);
- verify(httpClient).send(
- argThat(r ->
"http://localhost:8081/management/v1/configuration/node/".equals(r.uri().toString())
- && "PATCH".equals(r.method())
- && r.bodyPublisher().get().contentLength() ==
expSentContent.getBytes(UTF_8).length
- &&
"application/json".equals(r.headers().firstValue("Content-Type").get())),
- any());
- assertEquals("Configuration was updated successfully.\n\n"
+ assertThatExitCodeMeansSuccess(exitCode);
+
+ verify(httpClient).send(requestCaptor.capture(), any());
+ HttpRequest capturedRequest = requestCaptor.getValue();
+
+ assertThat(capturedRequest.uri().toString(),
is("http://localhost:8081/management/v1/configuration/node/"));
+ assertThat(capturedRequest.method(), is("PATCH"));
+ assertThat(requestBodyBytes(capturedRequest),
is(expSentContent.getBytes(UTF_8)));
+ assertThat(capturedRequest.headers().firstValue("Content-Type"),
isPresentAnd(is("application/json")));
+
+ assertOutputEqual("Configuration was updated successfully.\n\n"
+ "Use the " + cmd.getColorScheme().commandText("ignite
config get")
- + " command to view the updated configuration.\n",
out.toString());
+ + " command to view the updated configuration.\n",
out.toString(UTF_8));
+ assertThatStderrIsEmpty();
+ }
+ }
+
+ /**
+ * Tests "cluster" command.
+ */
+ @Nested
+ @DisplayName("cluster")
+ class Cluster {
Review comment:
ok!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]