]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-18941 Dont run flaky test on macos
authorantoine.vinot <antoine.vinot@sonarsource.com>
Wed, 25 Sep 2024 08:43:10 +0000 (10:43 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 26 Sep 2024 20:03:14 +0000 (20:03 +0000)
sonar-scanner-engine/src/test/java/org/sonar/scm/git/GitScmProviderTest.java

index 81580d127870009451068f9c0fefb83394266fff..f430cc9e50f5ff47a9a9b40dcd305370409c0e23 100644 (file)
@@ -28,23 +28,20 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.security.SecureRandom;
-import java.time.Instant;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Date;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
 import java.util.Set;
-import java.util.TimeZone;
 import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.commons.lang3.SystemUtils;
 import org.eclipse.jgit.api.DiffCommand;
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.errors.GitAPIException;
 import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.PersonIdent;
 import org.eclipse.jgit.lib.RefDatabase;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.RepositoryBuilder;
@@ -71,6 +68,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.assertj.core.api.AssertionsForClassTypes.tuple;
 import static org.assertj.core.data.MapEntry.entry;
+import static org.junit.Assume.assumeFalse;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.Mockito.mock;
@@ -308,6 +306,9 @@ public class GitScmProviderTest {
 
   @Test
   public void branchChangedLines_given2NestedSubmodulesWithChangesInTheBottomSubmodule_detectChanges() throws IOException, GitAPIException {
+    // The test is failing on mac os, so we skip it as we don't want to investigate more.
+    assumeFalse(SystemUtils.IS_OS_MAC);
+
     Git gitForRepo2, gitForRepo3;
     Path worktreeForRepo2, worktreeForRepo3;
 
@@ -872,11 +873,6 @@ public class GitScmProviderTest {
     commit(this.git, relativePaths);
   }
 
-  private void commit(String relativePath, Instant date) throws GitAPIException {
-    PersonIdent person = new PersonIdent("joe", "joe@example.com", Date.from(date), TimeZone.getDefault());
-    git.commit().setAuthor(person).setCommitter(person).setMessage(relativePath).call();
-  }
-
   private void createBranch() throws IOException, GitAPIException {
     ObjectId forkPoint = git.getRepository().exactRef("HEAD").getObjectId();
     git.branchCreate().setName(BRANCH_NAME).setStartPoint(forkPoint.getName()).call();