• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • support-core-plugin
    • None
    • support-core
    • support-core:2.65

      The CheckFilterTest is failing with the following issues:

      === Starting checkFilterTest(com.cloudbees.jenkins.support.CheckFilterTest)
         0.067 [id=14]	INFO	o.jvnet.hudson.test.WarExploder#explode: Picking up existing exploded jenkins.war at /Users/allan/Projects/dohbedoh/jenkins-plugins/support-core-plugin/target/jenkins-for-test
         0.388 [id=14]	INFO	o.jvnet.hudson.test.JenkinsRule#createWebServer: Running on http://localhost:54708/jenkins/
         1.934 [id=24]	INFO	jenkins.InitReactorRunner$1#onAttained: Started initialization
         2.377 [id=35]	WARNING	hudson.ClassicPluginStrategy#createClassJarFromWebInfClasses: Created /var/folders/m7/lghwdpdx70d6454dsp825bxc0000gn/T/jenkins2715125141041055036/async-http-client/WEB-INF/lib/classes.jar; update plugin to a version created with a newer harness
         3.017 [id=37]	INFO	jenkins.InitReactorRunner$1#onAttained: Listed all plugins
         5.225 [id=30]	INFO	jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
         5.245 [id=31]	INFO	jenkins.InitReactorRunner$1#onAttained: Started all plugins
         5.248 [id=27]	INFO	jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
         6.204 [id=26]	INFO	jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
         6.417 [id=22]	INFO	jenkins.InitReactorRunner$1#onAttained: Completed initialization
         6.436 [id=52]	INFO	hudson.UDPBroadcastThread#run: Cannot listen to UDP port 33,848, skipping: java.net.SocketException: Can't assign requested address
         8.946 [id=54]	INFO	o.j.h.test.SimpleCommandLauncher#launch: agent launched for slave0
        14.563 [id=14]	INFO	jenkins.model.Jenkins#cleanUp: Stopping Jenkins
        14.801 [id=14]	INFO	jenkins.model.Jenkins#cleanUp: Jenkins stopped
      
      java.lang.AssertionError: The file 'nodes/master/environment.txt' should have the word 'user_molecular_volunteer'. File content:
      

      nodes/master/environment.txt and nodes/slave/*/environment.txt are supposed have the word path filtered but they don't. The issue look transient though as the test is sometimes passing in jenkins.io, sometimes no:

      On my local machine OSX, this test always fails with the error above. On other colleague in Linux (Ubuntu) it works.

      In jenkins.io's build failure, the PATH word is just not replaced. In my environment, it is different, the PATH word is not there anymore and the value of my PATH environment variable is truncated.

          [JENKINS-59455] CheckFilterTest failing on environment.txt

          I have noticed that:

          It is my understanding that this test relies on the Environment Variables content to be filtered ? When I use a PrefilteredContent instead of the a PrintedContent and filter the entire line, it fix the text for me locally. Removing the cache however has no effect.

          Maybe mramonleon knows what is going on ?

          Allan BURDAJEWICZ added a comment - I have noticed that: 1) Environment Variables is actually not using a filtered content : https://github.com/jenkinsci/support-core-plugin/blob/support-core-2.61/src/main/java/com/cloudbees/jenkins/support/impl/EnvironmentVariables.java#L54-L85 2) Environment Variable component is using a cache: https://github.com/jenkinsci/support-core-plugin/blob/support-core-2.61/src/main/java/com/cloudbees/jenkins/support/impl/EnvironmentVariables.java#L87-L90 It is my understanding that this test relies on the Environment Variables content to be filtered ? When I use a PrefilteredContent instead of the a PrintedContent and filter the entire line, it fix the text for me locally. Removing the cache however has no effect. Maybe mramonleon knows what is going on ?

          Ramon Leon added a comment - - edited

          The environment.txt file is written by a PrintedContent which extends the Content which has shouldBeFiltered = true, so the file should be filtered.

          The CheckFilterTest supposes the environment.txt file in the bundle will have the path word, it's always on window or linux environments. The file is filled up with the result of a call to System.getenv(). Maybe the path variable is not between the env vars defined where the bundle is generated, but it's unlikely I guess.

           https://github.com/jenkinsci/support-core-plugin/blob/0695d2acea1300f2133522b722ad4e5cc8651c63/src/test/java/com/cloudbees/jenkins/support/CheckFilterTest.java#L234-L237

          Ramon Leon added a comment - - edited The environment.txt file is written by a PrintedContent which extends the Content which has shouldBeFiltered = true, so the file should be filtered. The CheckFilterTest supposes the environment.txt file in the bundle will have the path word, it's always on window or linux environments. The file is filled up with the result of a call to System.getenv() . Maybe the path variable is not between the env vars defined where the bundle is generated, but it's unlikely I guess.   https://github.com/jenkinsci/support-core-plugin/blob/0695d2acea1300f2133522b722ad4e5cc8651c63/src/test/java/com/cloudbees/jenkins/support/CheckFilterTest.java#L234-L237

          Baptiste Mathus added a comment - - edited

          > it's always on window or linux environments

          Well, my environment is a proof (I'm running Linux) it's not necessarily the case , or there's a bug somewhere. Hopefully it's in the tests only.
          Interestingly, I am reproducing that test failure every runs on the CLI. And I have no error while running the test from inside IntelliJ.

          Baptiste Mathus added a comment - - edited > it's always on window or linux environments Well, my environment is a proof (I'm running Linux) it's not necessarily the case , or there's a bug somewhere. Hopefully it's in the tests only. Interestingly, I am reproducing that test failure every runs on the CLI. And I have no error while running the test from inside IntelliJ.

          Ramon Leon added a comment - - edited

          Then it would be great if we use another word instead of path. But not sure which one could we use. Maybe some env var that is always set during the tests?. There is a way to add env vars but it implies using reflection and setAccesible(true) which I don't like.

          Ramon Leon added a comment - - edited Then it would be great if we use another word instead of path . But not sure which one could we use. Maybe some env var that is always set during the tests?. There is a way to add env vars but it implies using reflection and setAccesible(true) which I don't like.

          Summarizing the changes proposed by mramonleon and myself in https://github.com/jenkinsci/support-core-plugin/pull/200:

          • Use the first available env variable, and not path, to be sure it's available.
          • Wait for the created agent to be online.
          • Considerate '\0' (NUL character) as a character that appears to mark the end of a line, and so it must not make files containing it to be considered as binary files.

          Evaristo Gutierrez added a comment - Summarizing the changes proposed by mramonleon and myself in  https://github.com/jenkinsci/support-core-plugin/pull/200: Use the first available env variable, and not path, to be sure it's available. Wait for the created agent to be online. Considerate '\0' (NUL character) as a character that appears to mark the end of a line, and so it must not make files containing it to be considered as binary files.

            egutierrez Evaristo Gutierrez
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: