Uploaded image for project: 'Apache Storm'
  1. Apache Storm
  2. STORM-2892

Flux test fails to parse valid PATH environment variable

    XMLWordPrintableJSON

Details

    Description

      The flux tests rely on substituting the PATH environment variable into the substitution-test.yaml file.

      I noticed that the tests were failing when my PATH had a trailing colon, despite that being a valid PATH [1].

      Existing error

      mvn test output
      Running org.apache.storm.flux.TCKTest
      Tests run: 18, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.852 sec <<< FAILURE! - in org.apache.storm.flux.TCKTest
      testVariableSubstitution(org.apache.storm.flux.TCKTest)  Time elapsed: 0.012 sec  <<< ERROR!
      org.yaml.snakeyaml.scanner.ScannerException: null; mapping values are not allowed here;  in 'string', line 45, column 890:
           ... /usr/local/bin:/usr/bin:
                                      ^
              at org.yaml.snakeyaml.scanner.ScannerImpl.fetchValue(ScannerImpl.java:866)
              at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:360)
              at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226)
              at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:558)
              at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
              at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
              at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230)
              at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:159)
              at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:237)
              at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:159)
              at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122)
              at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
              at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120)
              at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481)
              at org.yaml.snakeyaml.Yaml.load(Yaml.java:400)
              at org.apache.storm.flux.parser.FluxParser.loadYaml(FluxParser.java:121)
              at org.apache.storm.flux.parser.FluxParser.parseInputStream(FluxParser.java:75)
              at org.apache.storm.flux.parser.FluxParser.parseResource(FluxParser.java:59)
              at org.apache.storm.flux.TCKTest.testVariableSubstitution(TCKTest.java:224)
      
      
      Results :
      
      Tests in error: 
        TCKTest.testVariableSubstitution:224 ยป Scanner null; mapping values are not al...
      

      Proposed solution

      Just wrap the PATH variable's contents in the yaml file.

      [1] PATH validity

      man bash
      ...
      
             PATH   The  search  path  for  commands.  It is a colon-separated
                    list of directories in which the shell looks for  commands
                    (see  COMMAND  EXECUTION  below).   A  zero-length  (null)
                    directory name in the value of PATH indicates the  current
                    directory.   A null directory name may appear as two adja-
                    cent colons, or as an  initial  or  trailing  colon.   The
                    default path is system-dependent, and is set by the admin-
                    istrator  who  installs   bash.    A   common   value   is
                    ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin''.
      ...
      

      Attachments

        Issue Links

          Activity

            People

              erikdw Erik Weathers
              erikdw Erik Weathers
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m