Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3248

SecureServerTest needs cleanup runServerCommand, possibly causing test failures when tests are run through ant.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 10.4.1.3
    • None
    • Test
    • Normal

    Description

      SecureServerTest.runServerCommand runs a command and then immediately creates a String based upon the output stream of the command. This string is then checked to see if it contains exception strings. However, I think that at the point the string is created there is no guarantee that the command has finished (or even started) execution. Thus there is a significant chance that the string will be empty (or at least missing exceptions) and thus always pass the test. Should the test be waiting for the command to complete using Process.waitFor().

      In getProcessOutput the bytes are converted to a String using the default encoding, this tends to cause problems for platforms with different encodings in test runs. It may be ok here since the output is from the system, if so it would be useful to have a comment indicating that the default encoding is ok here. (to avoid other tests blindly copying potentially error prone (due to encoding issues)code).

      In runServerCommand() if the exec fails the exception is just printed to System.err. SHould this instead be a fail() assertion. The test will fail if this occurs due to a NPE on the next access of serverProcess, but I think an explicit fail() would be more readable.

      I'm seeing 9 test failures when running derbynet._Suite through ant, on windows which I don't see if I run it directly using the swing test runner. This is one of the two tests that potentially cause issues (ie. removing it from the suite makes the failures disappear).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              djd Daniel John Debrunner
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: