From b2c420a124392b3e79a6abf263ec00f51e387409 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 20 Aug 2021 11:40:18 +1000 Subject: [PATCH] Issue #6327 Ensure TempDirTest runs in envs other than CI (#6638) * Issue #6327 Ensure TempDirTest runs in envs other than CI Signed-off-by: Jan Bartel * pass sysproperty env=ci to surefire run Signed-off-by: Olivier Lamy Co-authored-by: Olivier Lamy --- .../test/java/org/eclipse/jetty/webapp/TempDirTest.java | 7 +++++-- pom.xml | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/TempDirTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/TempDirTest.java index 97803758d4a..4f95f09fd1d 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/TempDirTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/TempDirTest.java @@ -27,6 +27,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfSystemProperty; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -289,9 +290,11 @@ public class TempDirTest /** * ServletContext.TEMPDIR has invalid String directory value (wrong permission to write into it) - * IllegalStateException + * + * Note that if run in the CI environment, the test will fail, because it runs as root, + * so we _will_ have permission to write to this directory. */ - @Disabled("Jenkins will run as root so we do have permission to write to this directory.") + @DisabledIfSystemProperty(named = "env", matches = "ci") @Test public void attributeWithInvalidPermissions() { diff --git a/pom.xml b/pom.xml index eee4038483d..13cbedc949b 100644 --- a/pom.xml +++ b/pom.xml @@ -1458,6 +1458,9 @@ ${maven.surefire.version} external, large-disk-resource + + ci +