Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove assertj and update pom #166

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.54</version>
<version>4.55</version>
<relativePath/>
</parent>

Expand All @@ -18,17 +18,16 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>

<jenkins.version>2.375.1</jenkins.version>
<jenkins.version>2.375.4</jenkins.version>
<jenkins-tools-bom.artifactId>bom-2.375.x</jenkins-tools-bom.artifactId>
<jenkins-tools-bom.version>1798.vc671fe94856f</jenkins-tools-bom.version>
<jenkins-tools-bom.version>1887.vda_d0ddb_c15c4</jenkins-tools-bom.version>

<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>

<aws-java-sdk.version>1.12.287-357.vf82d85a_6eefd</aws-java-sdk.version>
<aws-java-sdk.version>1.12.406-370.v8f993c987059</aws-java-sdk.version>
<aws-credentials.version>191.vcb_f183ce58b_9</aws-credentials.version>
<variant.version>59.vf075fe829ccb</variant.version>
<jsr305.version>3.0.2</jsr305.version>
<assertj-core.version>3.24.2</assertj-core.version>
<testcontainers.version>1.17.6</testcontainers.version>
<zstd-jni.version>1.5.4-1</zstd-jni.version>
<jackson2-api.version>2.14.2-319.v37853346a_229</jackson2-api.version>
Expand Down Expand Up @@ -94,13 +93,6 @@
<artifactId>zstd-jni</artifactId>
<version>${zstd-jni.version}</version>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down Expand Up @@ -140,6 +132,12 @@
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-definition</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
Expand All @@ -151,6 +149,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
import org.junit.rules.TemporaryFolder;
import org.jvnet.hudson.test.JenkinsRule;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;

import java.io.File;
import java.io.IOException;

import static org.assertj.core.api.Assertions.assertThat;

public class LocalItemStorageTest {

@Rule
Expand All @@ -23,12 +24,12 @@ public class LocalItemStorageTest {

@Test
public void testConfigRoundTrip() throws Exception {
assertThat(storage().getRoot()).isNull();
assertThat(storage().getRoot(), nullValue());
storage().setRoot("custom-root");

jenkins.configRoundtrip();

assertThat(storage().getRoot()).isEqualTo("custom-root");
assertThat(storage().getRoot(), is("custom-root"));
}

@Test
Expand All @@ -37,18 +38,18 @@ public void testCustomRootHandling() throws IOException, InterruptedException {

FreeStyleProject project = jenkins.createFreeStyleProject("project");
File cacheDir = cacheDir(project);
assertThat(cacheDir.getAbsolutePath()).isEqualTo(tempDirPath() + "/project/cache");
assertThat(cacheDir.getAbsolutePath(), is(tempDirPath() + "/project/cache"));

assertThat(cacheDir.mkdirs()).isTrue();
assertThat(cacheDir).isDirectory();
assertThat(cacheDir.mkdirs(), is(true));
assertThat(cacheDir.isDirectory(), is(true));

project.renameTo("renamed-project");
cacheDir = cacheDir(project);
assertThat(cacheDir.getAbsolutePath()).isEqualTo(tempDirPath() + "/renamed-project/cache");
assertThat(cacheDir).isDirectory();
assertThat(cacheDir.getAbsolutePath(), is(tempDirPath() + "/renamed-project/cache"));
assertThat(cacheDir.isDirectory(), is(true));

project.delete();
assertThat(cacheDir).doesNotExist();
assertThat(cacheDir.exists(), is(false));
}

private LocalItemStorage storage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import java.io.File;
import java.nio.charset.StandardCharsets;

import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;

public class ArbitraryFileCacheDockerPipelineTest {

Expand All @@ -34,13 +35,15 @@ public void testArbitraryFileCacheWithinDockerContainer() throws Exception {
WorkflowJob project = createTestProject(cacheDefinition);

WorkflowRun run1 = jenkins.assertBuildStatus(Result.SUCCESS, project.scheduleBuild2(0));
assertThat(run1.getLog())
.contains("[Cache for /tmp/test-path with id 72b62be1919b26a414e7b7bd4265f684] Searching cache in job specific caches...")
.contains("[Cache for /tmp/test-path with id 72b62be1919b26a414e7b7bd4265f684] Searching cache in default caches...")
.contains("[Cache for /tmp/test-path with id 72b62be1919b26a414e7b7bd4265f684] Skip restoring cache as no up-to-date cache exists")
.doesNotContain("expected output from test file")
.contains("[Cache for /tmp/test-path with id 72b62be1919b26a414e7b7bd4265f684] Cannot create cache as the path does not exist")
.contains("[Cache for /tmp/test-path with id 72b62be1919b26a414e7b7bd4265f684] Note that paths outside the workspace while using the Docker Pipeline plugin are not supported");

assertThat(run1.getLog(), allOf(
containsString("[Cache for /tmp/test-path with id 72b62be1919b26a414e7b7bd4265f684] Searching cache in job specific caches..."),
containsString("[Cache for /tmp/test-path with id 72b62be1919b26a414e7b7bd4265f684] Searching cache in default caches..."),
containsString("[Cache for /tmp/test-path with id 72b62be1919b26a414e7b7bd4265f684] Skip restoring cache as no up-to-date cache exists"),
not(containsString("expected output from test file")),
containsString("[Cache for /tmp/test-path with id 72b62be1919b26a414e7b7bd4265f684] Cannot create cache as the path does not exist"),
containsString("[Cache for /tmp/test-path with id 72b62be1919b26a414e7b7bd4265f684] Note that paths outside the workspace while using the Docker Pipeline plugin are not supported")
));
}

private WorkflowJob createTestProject(String cacheDefinition) throws Exception {
Expand Down
Loading