rpuch commented on code in PR #7192:
URL: https://github.com/apache/ignite-3/pull/7192#discussion_r2609512398
##########
modules/compatibility-tests/src/jobs/java/org/apache/ignite/internal/compute/CheckpointJob.java:
##########
@@ -63,7 +64,7 @@ public CompletableFuture<Void>
executeAsync(JobExecutionContext context, Boolean
}
});
} catch (Exception e) {
Review Comment:
Could we just remove the try/catch?
##########
modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/ItVaultStorageCompatibilityTest.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.ignite.internal;
+
+import static
org.apache.ignite.internal.CompatibilityTestCommon.createDefaultTables;
+import static org.apache.ignite.internal.TestWrappers.unwrapIgniteImpl;
+import static org.apache.ignite.internal.compute.PutVaultEntriesJob.NEW_VALUE;
+import static
org.apache.ignite.internal.compute.PutVaultEntriesJob.OVERWRITTEN_KEY;
+import static
org.apache.ignite.internal.compute.PutVaultEntriesJob.REMOVED_KEY;
+import static org.apache.ignite.internal.compute.PutVaultEntriesJob.TEST_KEY;
+import static org.apache.ignite.internal.compute.PutVaultEntriesJob.TEST_VALUE;
+import static org.apache.ignite.internal.jobs.DeploymentUtils.runJob;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.nullValue;
+
+import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.app.IgniteImpl;
+import org.apache.ignite.internal.compute.PutVaultEntriesJob;
+import org.apache.ignite.internal.jobs.DeploymentUtils;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.MethodSource;
+
+/** Compatibility tests for vault storage. */
+@ParameterizedClass
+@MethodSource("baseVersions")
+@MicronautTest(rebuildContext = true)
+public class ItVaultStorageCompatibilityTest extends CompatibilityTestBase {
+ @Override
+ protected int nodesCount() {
+ return 1;
+ }
+
+ @Override
+ protected void setupBaseVersion(Ignite baseIgnite) {
+ DeploymentUtils.deployJobs();
+
+ createDefaultTables(baseIgnite);
Review Comment:
Why do we need any tables in this test?
##########
modules/compatibility-tests/src/jobs/java/org/apache/ignite/internal/compute/PutVaultEntriesJob.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.ignite.internal.compute;
+
+import static java.util.concurrent.CompletableFuture.failedFuture;
+import static
org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture;
+
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.JobExecutionContext;
+import org.apache.ignite.internal.app.IgniteImpl;
+import org.apache.ignite.internal.lang.ByteArray;
+import org.apache.ignite.internal.vault.VaultManager;
+import org.apache.ignite.internal.wrapper.Wrappers;
+
+/** A job that writes values specified in constants to node's vault. */
+public class PutVaultEntriesJob implements ComputeJob<String, Void> {
+ public static final ByteArray TEST_KEY = new
ByteArray("test_key".getBytes(StandardCharsets.UTF_8));
+
+ public static final byte[] TEST_VALUE =
"test_value".getBytes(StandardCharsets.UTF_8);
+
+ public static final ByteArray OVERWRITTEN_KEY = new
ByteArray("overwritten_key".getBytes(StandardCharsets.UTF_8));
+
+ public static final byte[] INITIAL_VALUE =
"initial_value".getBytes(StandardCharsets.UTF_8);
+
+ public static final byte[] NEW_VALUE =
"NEW_VALUE".getBytes(StandardCharsets.UTF_8);
+
+ public static final ByteArray REMOVED_KEY = new
ByteArray("removed_key".getBytes(StandardCharsets.UTF_8));
+
+ @Override
+ public CompletableFuture<Void> executeAsync(JobExecutionContext context,
String arg) {
+
+ try {
+ IgniteImpl igniteImpl = Wrappers.unwrap(context.ignite(),
IgniteImpl.class);
Review Comment:
Let's use `JobsCommon` to unwrap `IgniteImpl`
##########
modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/ItVaultStorageCompatibilityTest.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.ignite.internal;
+
+import static
org.apache.ignite.internal.CompatibilityTestCommon.createDefaultTables;
+import static org.apache.ignite.internal.TestWrappers.unwrapIgniteImpl;
+import static org.apache.ignite.internal.compute.PutVaultEntriesJob.NEW_VALUE;
+import static
org.apache.ignite.internal.compute.PutVaultEntriesJob.OVERWRITTEN_KEY;
+import static
org.apache.ignite.internal.compute.PutVaultEntriesJob.REMOVED_KEY;
+import static org.apache.ignite.internal.compute.PutVaultEntriesJob.TEST_KEY;
+import static org.apache.ignite.internal.compute.PutVaultEntriesJob.TEST_VALUE;
+import static org.apache.ignite.internal.jobs.DeploymentUtils.runJob;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.nullValue;
+
+import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.app.IgniteImpl;
+import org.apache.ignite.internal.compute.PutVaultEntriesJob;
+import org.apache.ignite.internal.jobs.DeploymentUtils;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.MethodSource;
+
+/** Compatibility tests for vault storage. */
+@ParameterizedClass
+@MethodSource("baseVersions")
+@MicronautTest(rebuildContext = true)
+public class ItVaultStorageCompatibilityTest extends CompatibilityTestBase {
+ @Override
+ protected int nodesCount() {
+ return 1;
+ }
+
+ @Override
+ protected void setupBaseVersion(Ignite baseIgnite) {
+ DeploymentUtils.deployJobs();
+
+ createDefaultTables(baseIgnite);
+
+ runPutVaultEntriesJob();
+ }
+
+ @Test
+ void testVaultStorageCompatibility() {
+ IgniteImpl ignite = unwrapIgniteImpl(cluster.node(0));
+ assertThat(ignite.vault().get(TEST_KEY).value(), is(TEST_VALUE));
+ assertThat(ignite.vault().get(OVERWRITTEN_KEY).value(), is(NEW_VALUE));
+ assertThat(ignite.vault().get(REMOVED_KEY), nullValue());
Review Comment:
```suggestion
assertThat(ignite.vault().get(REMOVED_KEY), is(nullValue()));
```
Reads just a little bit more like plain English
##########
modules/compatibility-tests/src/jobs/java/org/apache/ignite/internal/compute/TruncateRaftLogCommand.java:
##########
@@ -48,7 +48,7 @@ public CompletableFuture<Void>
executeAsync(JobExecutionContext context, String
.thenCompose(ignored ->
messagingService.invoke(igniteImpl.name(), request, 10_000L))
.thenApply(ignored -> null);
} catch (Exception e) {
Review Comment:
Could we just remove the try/catch?
##########
modules/compatibility-tests/src/jobs/java/org/apache/ignite/internal/compute/PutVaultEntriesJob.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.ignite.internal.compute;
+
+import static java.util.concurrent.CompletableFuture.failedFuture;
+import static
org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture;
+
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.JobExecutionContext;
+import org.apache.ignite.internal.app.IgniteImpl;
+import org.apache.ignite.internal.lang.ByteArray;
+import org.apache.ignite.internal.vault.VaultManager;
+import org.apache.ignite.internal.wrapper.Wrappers;
+
+/** A job that writes values specified in constants to node's vault. */
+public class PutVaultEntriesJob implements ComputeJob<String, Void> {
+ public static final ByteArray TEST_KEY = new
ByteArray("test_key".getBytes(StandardCharsets.UTF_8));
+
+ public static final byte[] TEST_VALUE =
"test_value".getBytes(StandardCharsets.UTF_8);
+
+ public static final ByteArray OVERWRITTEN_KEY = new
ByteArray("overwritten_key".getBytes(StandardCharsets.UTF_8));
+
+ public static final byte[] INITIAL_VALUE =
"initial_value".getBytes(StandardCharsets.UTF_8);
+
+ public static final byte[] NEW_VALUE =
"NEW_VALUE".getBytes(StandardCharsets.UTF_8);
+
+ public static final ByteArray REMOVED_KEY = new
ByteArray("removed_key".getBytes(StandardCharsets.UTF_8));
+
+ @Override
+ public CompletableFuture<Void> executeAsync(JobExecutionContext context,
String arg) {
+
+ try {
Review Comment:
Do we need these try/catch blocks in all our test jobs? It seems that, if an
exception gets throw, we'll still get it on the calling side
##########
modules/compatibility-tests/src/jobs/java/org/apache/ignite/internal/compute/SendAllMetastorageCommandTypesJob.java:
##########
@@ -62,7 +63,7 @@ public CompletableFuture<Void>
executeAsync(JobExecutionContext context, String
sendCompactionCommand(metastorage)
).thenCompose((v) -> metastorage.storage().flush());
} catch (Exception e) {
Review Comment:
Could we just remove the try/catch?
##########
modules/compatibility-tests/src/jobs/java/org/apache/ignite/internal/compute/PutVaultEntriesJob.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.ignite.internal.compute;
+
+import static java.util.concurrent.CompletableFuture.failedFuture;
+import static
org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture;
+
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.JobExecutionContext;
+import org.apache.ignite.internal.app.IgniteImpl;
+import org.apache.ignite.internal.lang.ByteArray;
+import org.apache.ignite.internal.vault.VaultManager;
+import org.apache.ignite.internal.wrapper.Wrappers;
+
+/** A job that writes values specified in constants to node's vault. */
+public class PutVaultEntriesJob implements ComputeJob<String, Void> {
+ public static final ByteArray TEST_KEY = new
ByteArray("test_key".getBytes(StandardCharsets.UTF_8));
+
+ public static final byte[] TEST_VALUE =
"test_value".getBytes(StandardCharsets.UTF_8);
+
+ public static final ByteArray OVERWRITTEN_KEY = new
ByteArray("overwritten_key".getBytes(StandardCharsets.UTF_8));
+
+ public static final byte[] INITIAL_VALUE =
"initial_value".getBytes(StandardCharsets.UTF_8);
+
+ public static final byte[] NEW_VALUE =
"NEW_VALUE".getBytes(StandardCharsets.UTF_8);
+
+ public static final ByteArray REMOVED_KEY = new
ByteArray("removed_key".getBytes(StandardCharsets.UTF_8));
+
+ @Override
+ public CompletableFuture<Void> executeAsync(JobExecutionContext context,
String arg) {
+
+ try {
+ IgniteImpl igniteImpl = Wrappers.unwrap(context.ignite(),
IgniteImpl.class);
+
+ VaultManager vault = igniteImpl.vault();
+
+ vault.put(TEST_KEY, TEST_VALUE);
+ vault.put(OVERWRITTEN_KEY, INITIAL_VALUE);
+ vault.put(REMOVED_KEY, INITIAL_VALUE);
+ vault.put(OVERWRITTEN_KEY, NEW_VALUE);
Review Comment:
Let's also test putAll() in the same vein as put()
--
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]