Skip to content
Permalink
Browse files

[JENKINS-42310] Added Test cases for the GitShallow Lint defect

  • Loading branch information...
v1v committed Feb 25, 2017
1 parent ece383c commit 03de2c265e5c348e672c82cd576672ac25f628f7
@@ -1,11 +1,14 @@
package org.jenkins.ci.plugins.jenkinslint.check;

import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import hudson.model.FreeStyleProject;
import hudson.plugins.git.extensions.GitSCMExtension;
import hudson.plugins.git.extensions.impl.CleanCheckout;
import hudson.plugins.git.extensions.impl.CloneOption;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;

import java.util.*;
@@ -67,6 +70,51 @@
project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
assertFalse(checker.executeCheck(project));
}

@Issue("JENKINS-42310")
@Test public void testMavenModuleJob() throws Exception {
MavenModuleSet project = j.createMavenProject();
assertFalse(checker.executeCheck(project));
}
@Issue("JENKINS-42310")
@Test public void testMavenGit() throws Exception {
MavenModuleSet project = j.createMavenProject();
project.setScm(new hudson.plugins.git.GitSCM(""));
assertTrue(checker.executeCheck(project));
project.delete();
project = j.createMavenProject();
ArrayList<GitSCMExtension> extensions = new ArrayList<GitSCMExtension>();
extensions.add(new CloneOption(false, "", 0));
project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
assertTrue(checker.executeCheck(project));
project.delete();
project = j.createMavenProject();
extensions.add(new CloneOption(true, "", 0));
project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
assertFalse(checker.executeCheck(project));
}
@Issue("JENKINS-42310")
@Test public void testMatrixProject() throws Exception {
MatrixProject project = j.createMatrixProject();
assertFalse(checker.executeCheck(project));
}
@Issue("JENKINS-42310")
@Test public void testMatrixProjectGit() throws Exception {
MatrixProject project = j.createMatrixProject();
project.setScm(new hudson.plugins.git.GitSCM(""));
assertTrue(checker.executeCheck(project));
project.delete();
project = j.createMatrixProject();
ArrayList<GitSCMExtension> extensions = new ArrayList<GitSCMExtension>();
extensions.add(new CloneOption(false, "", 0));
project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
assertTrue(checker.executeCheck(project));
project.delete();
project = j.createMatrixProject();
extensions.add(new CloneOption(true, "", 0));
project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
assertFalse(checker.executeCheck(project));
}
@Test public void testControlComment() throws Exception {
FreeStyleProject project = j.createFreeStyleProject();
assertFalse(checker.isIgnored(project.getDescription()));

0 comments on commit 03de2c2

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.