From 4b8286ee06a1c02b726f0e69172980107f4ea8f4 Mon Sep 17 00:00:00 2001 From: Raymond Wu Date: Mon, 21 Oct 2024 17:39:17 -0400 Subject: [PATCH 1/2] Updated dependencies --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 1cbcde3..5d0a4a7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.jenkins-ci.plugins plugin - 4.88 + 5.2 @@ -38,9 +38,9 @@ 2 - 999999-SNAPSHOT + -SNAPSHOT - 2.387.3 + 2.479 jenkinsci/${project.artifactId} true @@ -52,8 +52,8 @@ io.jenkins.tools.bom - bom-2.387.x - 2543.vfb_1a_5fb_9496d + bom-2.479.x + 3722.vcc62e7311580 pom import From 6d10e48925b975e6ee679838390b9751dd7e551c Mon Sep 17 00:00:00 2001 From: Raymond Wu Date: Wed, 27 Nov 2024 15:32:46 -0500 Subject: [PATCH 2/2] Updated tests --- .../plugins/globalEventsPlugin/GlobalEventsPluginTest.groovy | 5 +++-- .../globalEventsPlugin/acceptance/AcceptanceTests.java | 4 ++++ .../plugins/globalEventsPlugin/acceptance/StepDefs.groovy | 3 --- .../globalEventsPlugin/acceptance/WipAcceptanceTests.java | 4 ++++ .../acceptance/Groovy Script - Runtime.feature | 3 +-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/GlobalEventsPluginTest.groovy b/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/GlobalEventsPluginTest.groovy index 56e779f..e9eb9be 100644 --- a/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/GlobalEventsPluginTest.groovy +++ b/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/GlobalEventsPluginTest.groovy @@ -5,6 +5,7 @@ import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.rules.TemporaryFolder +import org.jvnet.hudson.test.JenkinsRule import java.util.concurrent.Callable import java.util.concurrent.ExecutorService @@ -18,6 +19,8 @@ import static groovy.test.GroovyAssert.shouldFail * Created by nickgrealy@gmail.com. */ class GlobalEventsPluginTest { + @Rule + public JenkinsRule jenkinsRule = new JenkinsRule() private GlobalEventsPlugin.DescriptorImpl plugin private LoggerTrap logger @@ -27,8 +30,6 @@ class GlobalEventsPluginTest { @Before void setup() { - // disable load method, create new plugin... - GlobalEventsPlugin.DescriptorImpl.metaClass.load = {} plugin = new GlobalEventsPlugin.DescriptorImpl(ClassLoader.getSystemClassLoader()) logger = new LoggerTrap(GlobalEventsPluginTest.name) } diff --git a/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/AcceptanceTests.java b/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/AcceptanceTests.java index a626df0..fa1167e 100644 --- a/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/AcceptanceTests.java +++ b/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/AcceptanceTests.java @@ -2,7 +2,9 @@ import io.cucumber.junit.Cucumber; import io.cucumber.junit.CucumberOptions; +import org.junit.ClassRule; import org.junit.runner.RunWith; +import org.jvnet.hudson.test.JenkinsRule; @RunWith(Cucumber.class) @CucumberOptions( @@ -10,4 +12,6 @@ tags = "not @ignore" ) public class AcceptanceTests { + @ClassRule + public static JenkinsRule jenkinsRule = new JenkinsRule(); } diff --git a/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/StepDefs.groovy b/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/StepDefs.groovy index 5e9dd33..1f63c38 100644 --- a/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/StepDefs.groovy +++ b/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/StepDefs.groovy @@ -15,7 +15,6 @@ import org.jenkinsci.plugins.globalEventsPlugin.GlobalQueueListener import org.jenkinsci.plugins.globalEventsPlugin.LoggerTrap class StepDefs { - GlobalEventsPlugin.DescriptorImpl plugin GlobalRunListener runListener GlobalComputerListener computerListener @@ -30,8 +29,6 @@ class StepDefs { @Before void setup() { - // disable load method, create new plugin... - GlobalEventsPlugin.DescriptorImpl.metaClass.load = {} plugin = new GlobalEventsPlugin.DescriptorImpl(ClassLoader.getSystemClassLoader()) logger = new LoggerTrap(GlobalEventsPluginTest.name) diff --git a/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/WipAcceptanceTests.java b/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/WipAcceptanceTests.java index 56d783a..4db563a 100644 --- a/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/WipAcceptanceTests.java +++ b/src/test/groovy/org/jenkinsci/plugins/globalEventsPlugin/acceptance/WipAcceptanceTests.java @@ -2,7 +2,9 @@ import io.cucumber.junit.Cucumber; import io.cucumber.junit.CucumberOptions; +import org.junit.ClassRule; import org.junit.runner.RunWith; +import org.jvnet.hudson.test.JenkinsRule; @RunWith(Cucumber.class) @CucumberOptions( @@ -10,4 +12,6 @@ tags = "@wip and not @ignore" ) public class WipAcceptanceTests { + @ClassRule + public static JenkinsRule jenkinsRule = new JenkinsRule(); } diff --git a/src/test/resources/org/jenkinsci/plugins/globalEventsPlugin/acceptance/Groovy Script - Runtime.feature b/src/test/resources/org/jenkinsci/plugins/globalEventsPlugin/acceptance/Groovy Script - Runtime.feature index 9aeeebb..8b758e3 100644 --- a/src/test/resources/org/jenkinsci/plugins/globalEventsPlugin/acceptance/Groovy Script - Runtime.feature +++ b/src/test/resources/org/jenkinsci/plugins/globalEventsPlugin/acceptance/Groovy Script - Runtime.feature @@ -63,12 +63,11 @@ Feature: Groovy Script - Runtime Scenario: All relevant job parameters should passed into the script, so that I don't have to manually retrieve data Given the script """ - log.info("${log.class}, $listener, $jenkins, $context, $run, $event, $env") + log.info("${log.class}, $listener, null, $context, $run, $event, $env") """ When the Run.onStarted event is triggered Then the log level info should display 'class org.jenkinsci.plugins.globalEventsPlugin.LoggerTrap, null, null, [:], null, RunListener.onStarted, [:]' - Scenario: If the script outputs a map, it should be placed into the cache for subsequent executions, so that the script can keep "memory" Given the script """