[ 
https://issues.apache.org/jira/browse/DERBY-6225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13663758#comment-13663758
 ] 

Dag H. Wanvik commented on DERBY-6225:
--------------------------------------

Cf this output from 
http://download.java.net/javadesktop/derby/javadb-5577046-report/javadb-task-3654391.html:

 junit.framework.AssertionFailedError: SecureServerTest( Opened = false, 
Authenticated= false, CustomDerbyProperties= 
functionTests/tests/derbynet/SecureServerTest.derby.properties, WildCardHost= 
null )
Expected: Security manager installed using the Basic server security policy.
But saw: 
        at 
org.apache.derbyTesting.functionTests.tests.derbynet.SecureServerTest.testServerStartup(SecureServerTest.java:328)
        at 
org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:117)
        ;

so the stdout is empty, but we expect to see the server report that the basic 
server security policy has been installed.  I suspect this can be a race 
condition. In the source for the test I see these lines:

    String      serverOutput = getServerOutput();  
    boolean     serverCameUp = serverCameUp();
    boolean     outputOK = ( serverOutput.indexOf( 
_outcome.expectedServerOutput() ) >= 0 );

    assertEquals( myName + ": serverCameUp = " + serverCameUp, 
                  _outcome.serverShouldComeUp(), serverCameUp );

    if (!(runsWithEmma() || runsWithJaCoCo())) {
        // With Emma we run without the security manager, so we can't
        // assert on seeing it.
        assertTrue( myName + "\nExpected: " +
                    _outcome.expectedServerOutput() +
                    "\nBut saw: " + serverOutput , outputOK );

We assert against the variable serverOutput which is collected *before* the 
call to serverCameUp. The latter has a ping/wait loop to wait for a slow server 
startup.  It seems to be it would be safer to collect the server output *after* 
we check that has indeed been started.


                
> SecureServerTest assertion error on contents of stdout from subprocess
> ----------------------------------------------------------------------
>
>                 Key: DERBY-6225
>                 URL: https://issues.apache.org/jira/browse/DERBY-6225
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to