sklaha commented on code in PR #265:
URL: https://github.com/apache/cassandra-sidecar/pull/265#discussion_r2493426038


##########
integration-tests/src/integrationTest/org/apache/cassandra/sidecar/routes/CassandraNodeOperationsIntegrationTest.java:
##########
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.sidecar.routes;
+
+import java.util.concurrent.TimeUnit;
+
+import org.junit.jupiter.api.Test;
+
+import io.vertx.core.buffer.Buffer;
+import io.vertx.core.json.JsonObject;
+import io.vertx.ext.web.client.HttpResponse;
+import org.apache.cassandra.sidecar.common.ApiEndpointsV1;
+import org.apache.cassandra.sidecar.common.data.OperationalJobStatus;
+import 
org.apache.cassandra.sidecar.testing.SharedClusterSidecarIntegrationTestBase;
+
+import static io.netty.handler.codec.http.HttpResponseStatus.ACCEPTED;
+import static io.netty.handler.codec.http.HttpResponseStatus.OK;
+import static org.apache.cassandra.testing.utils.AssertionUtils.getBlocking;
+import static org.apache.cassandra.testing.utils.AssertionUtils.loopAssert;
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Integration tests for Cassandra node operations
+ */
+public class CassandraNodeOperationsIntegrationTest extends 
SharedClusterSidecarIntegrationTestBase
+{
+    public static final String CASSANDRA_VERSION_4_0 = "4.0";
+
+    @Override
+    protected void initializeSchemaForTest()
+    {
+        // No schema init needed
+    }
+
+    @Override
+    protected void beforeTestStart()
+    {
+        // wait for the schema initialization
+        waitForSchemaReady(30, TimeUnit.SECONDS);
+    }
+
+    @Test
+    void testNodeMoveOperationSuccess()
+    {
+        // Use a test token - this is a valid token for Murmur3Partitioner 
+        String testToken = "123456789";
+
+        // Initiate move operation
+        HttpResponse<Buffer> moveResponse = getBlocking(
+        trustedClient().put(serverWrapper.serverPort, "localhost", 
ApiEndpointsV1.NODE_MOVE_ROUTE + "?newToken=" + testToken)
+                       .send());
+
+        assertThat(moveResponse.statusCode()).isIn(OK.code(), ACCEPTED.code());
+
+        JsonObject responseBody = moveResponse.bodyAsJsonObject();
+        assertThat(responseBody).isNotNull();
+        assertThat(responseBody.getString("jobId")).isNotNull();
+        assertThat(responseBody.getString("operation")).isEqualTo("move");
+        assertThat(responseBody.getString("jobStatus")).isIn(
+        OperationalJobStatus.CREATED.name(),
+        OperationalJobStatus.RUNNING.name(),
+        OperationalJobStatus.SUCCEEDED.name()
+        );
+
+        // Verify the job eventually completes (or at least gets processed)
+        loopAssert(30, 500, () -> {
+            HttpResponse<Buffer> streamStatsResponse = getBlocking(
+            trustedClient().get(serverWrapper.serverPort, "localhost", 
ApiEndpointsV1.STREAM_STATS_ROUTE)
+                           .send());
+
+            assertThat(streamStatsResponse.statusCode()).isEqualTo(OK.code());
+
+            JsonObject streamStats = streamStatsResponse.bodyAsJsonObject();
+            assertThat(streamStats).isNotNull();
+            // The operationMode should be either NORMAL (completed) or MOVING 
(in progress)
+            assertThat(streamStats.getString("operationMode")).isIn("NORMAL", 
"MOVING");

Review Comment:
   Done here: https://github.com/apache/cassandra-sidecar/pull/265



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to