You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "valepakh (via GitHub)" <gi...@apache.org> on 2023/06/09 13:02:44 UTC

[GitHub] [ignite-3] valepakh commented on a diff in pull request #2151: IGNITE-19518 Validate unit after node restart

valepakh commented on code in PR #2151:
URL: https://github.com/apache/ignite-3/pull/2151#discussion_r1224270773


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/deployment/DeployFiles.java:
##########
@@ -0,0 +1,154 @@
+/*
+ * 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.deployment;
+
+import static org.apache.ignite.internal.rest.api.deployment.DeploymentStatus.DEPLOYED;
+import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willBe;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.apache.ignite.compute.version.Version;
+import org.apache.ignite.internal.app.IgniteImpl;
+import org.apache.ignite.internal.deployunit.DeploymentUnit;
+import org.apache.ignite.internal.deployunit.UnitStatuses;
+import org.apache.ignite.internal.deployunit.UnitStatuses.UnitStatusesBuilder;
+
+class DeployFiles {
+    private static final int BASE_REPLICA_TIMEOUT = 30;
+
+    private static final long SMALL_IN_BYTES = 1024L;
+
+    private static final long MEDIUM_IN_BYTES = 1024L * 1024L;
+
+    private static final long BIG_IN_BYTES = 100 * 1024L * 1024L;
+
+    private final Path workDir;
+
+    private final DeployFile smallFile;
+
+    private final DeployFile mediumFile;
+
+    private DeployFile bigFile;
+
+    private final List<DeployFile> allFiles;
+
+    // TODO https://issues.apache.org/jira/browse/IGNITE-19009
+    DeployFiles(Path workDir) throws IOException {
+        this.workDir = workDir;
+        smallFile = create(workDir.resolve("small.txt"), SMALL_IN_BYTES, BASE_REPLICA_TIMEOUT);
+        mediumFile = create(workDir.resolve("medium.txt"), MEDIUM_IN_BYTES, BASE_REPLICA_TIMEOUT * 2);
+        bigFile = create(workDir.resolve("big.txt"), BIG_IN_BYTES, BASE_REPLICA_TIMEOUT * 3);
+        allFiles = List.of(smallFile, mediumFile);
+    }
+
+    private DeployFile create(Path path, long size, int replicaTimeout) throws IOException {
+        DeployFile deployFile = new DeployFile(path, size, replicaTimeout);
+        deployFile.ensureExists();

Review Comment:
   Maybe we could create the file only when it's needed?
   Otherwise 100 MB file will be created before each deployment test even when it's not used.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org