You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/06/15 06:18:49 UTC

[GitHub] [maven-build-cache-extension] olamy commented on a diff in pull request #21: Add a remote cache IT

olamy commented on code in PR #21:
URL: https://github.com/apache/maven-build-cache-extension/pull/21#discussion_r897575746


##########
src/test/java/org/apache/maven/buildcache/its/RemoteCacheDavTest.java:
##########
@@ -0,0 +1,493 @@
+/*
+ * 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.maven.buildcache.its;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.FileTime;
+import java.nio.file.attribute.PosixFilePermission;
+import java.nio.file.attribute.PosixFilePermissions;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.maven.buildcache.its.junit.BeforeEach;
+import org.apache.maven.buildcache.its.junit.Inject;
+import org.apache.maven.buildcache.its.junit.IntegrationTest;
+import org.apache.maven.buildcache.its.junit.IntegrationTestExtension;
+import org.apache.maven.it.VerificationException;
+import org.apache.maven.it.Verifier;
+import org.jetbrains.annotations.NotNull;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledOnOs;
+import org.junit.jupiter.api.condition.OS;
+import org.testcontainers.DockerClientFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
+import org.testcontainers.utility.DockerImageName;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+@IntegrationTest( "src/test/projects/remote-cache-dav" )
+@Testcontainers
+@EnabledOnOs( OS.LINUX ) // github actions do not support docker on windows and osx
+public class RemoteCacheDavTest
+{
+
+    public static final String DAV_DOCKER_IMAGE = "xama/nginx-webdav@sha256:84171a7e67d7e98eeaa67de58e3ce141ec1d0ee9c37004e7096698c8379fd9cf";
+    private static final String DAV_USERNAME = "admin";
+    private static final String DAV_PASSWORD = "admin";
+    private static final String REPO_ID = "build-cache";
+    private static final String HTTP_TRANSPORT_PRIORITY = "aether.priority.org.eclipse.aether.transport.http.HttpTransporterFactory";
+    private static final String WAGON_TRANSPORT_PRIORITY = "aether.priority.org.eclipse.aether.transport.wagon.WagonTransporterFactory";
+    private static final String MAVEN_BUILD_CACHE_REMOTE_SAVE_ENABLED = "maven.build.cache.remote.save.enabled";
+
+    @Container
+    GenericContainer<?> dav;
+
+    @Inject
+    Verifier verifier;
+
+    Path basedir;
+    Path remoteCache;
+    Path localCache;
+    Path settings;
+    Path logDir;
+
+    @BeforeEach
+    void setup() throws IOException
+    {
+        assumeTrue( DockerClientFactory.instance().isDockerAvailable(), "docker is not available" );

Review Comment:
   just use `@Testcontainers(disabledWithoutDocker = true)` at class level and you do not need that



-- 
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: issues-unsubscribe@maven.apache.org

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