[ 
https://issues.apache.org/jira/browse/KNOX-1004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Denes Bodo updated KNOX-1004:
-----------------------------
    Description: 
Found flaky unit test in Knox:
org.apache.hadoop.gateway.GatewayAppFuncTest.testDefaultTopology

The problem occurs when the run is a little bit slower. The directory deletion 
during test cleanup fails due to missing directories. The directories are being 
deleted by Knox TopologyService.

The problem in code where the second deletion is failing sometimes:
{noformat}
  @After
  public void cleanupTest() throws Exception {
    FileUtils.cleanDirectory( new File( config.getGatewayTopologyDir() ) );
    FileUtils.cleanDirectory( new File( config.getGatewayDeploymentDir() ) );
  }
{noformat}

Due to removing working directories are being deleted during cleanupSuite I 
suggest remove deployment directory ignoring file-not-found errors. For example:

{noformat}
  @After
  public void cleanupTest() throws Exception {
    ...
    FileUtils.deleteQuietly( new File( config.getGatewayDeploymentDir() ) );
  }
{noformat}



h2. Reproduction:
Place a breakpoint at the deployment deletion and then slowly follow the steps. 
During in a file browser the deletion can be seen.

  was:
Found flaky unit test in Knox:
org.apache.hadoop.gateway.GatewayAppFuncTest.testDefaultTopology

The problem occurs when the run is a little bit slower. The directory deletion 
during test cleanup fails due to missing directories. The directories are being 
deleted by Knox TopologyService.

The problem in code where the second deletion is failing sometimes:
{noformat}
  @After
  public void cleanupTest() throws Exception {
    FileUtils.cleanDirectory( new File( config.getGatewayTopologyDir() ) );
    FileUtils.cleanDirectory( new File( config.getGatewayDeploymentDir() ) );
  }
{noformat}

Due to removing working directories are being deleted during cleanupSuite I 
suggest remove deployment directory ignoring file-not-found errors. For example:

{noformat}
  @After
  public void cleanupTest() throws Exception {
    ...
    FileUtils.deleteQuietly( new File( config.getGatewayDeploymentDir() ) );
  }
{noformat}



h2. Reproduction:
Place a breakpoint at the deployment deletion and then slowly follow the steps. 
During in a file browser the deletion can be seen.
Or place some delay between topology and deployment deletion in cleanupTest. 
(does not tested)


> Failing (flaky) Knox unit test: 
> org.apache.hadoop.gateway.GatewayAppFuncTest.testDefaultTopology
> ------------------------------------------------------------------------------------------------
>
>                 Key: KNOX-1004
>                 URL: https://issues.apache.org/jira/browse/KNOX-1004
>             Project: Apache Knox
>          Issue Type: Bug
>          Components: Tests
>    Affects Versions: 0.12.0
>         Environment: local machine
>            Reporter: Denes Bodo
>            Priority: Minor
>             Fix For: 0.14.0
>
>
> Found flaky unit test in Knox:
> org.apache.hadoop.gateway.GatewayAppFuncTest.testDefaultTopology
> The problem occurs when the run is a little bit slower. The directory 
> deletion during test cleanup fails due to missing directories. The 
> directories are being deleted by Knox TopologyService.
> The problem in code where the second deletion is failing sometimes:
> {noformat}
>   @After
>   public void cleanupTest() throws Exception {
>     FileUtils.cleanDirectory( new File( config.getGatewayTopologyDir() ) );
>     FileUtils.cleanDirectory( new File( config.getGatewayDeploymentDir() ) );
>   }
> {noformat}
> Due to removing working directories are being deleted during cleanupSuite I 
> suggest remove deployment directory ignoring file-not-found errors. For 
> example:
> {noformat}
>   @After
>   public void cleanupTest() throws Exception {
>     ...
>     FileUtils.deleteQuietly( new File( config.getGatewayDeploymentDir() ) );
>   }
> {noformat}
> h2. Reproduction:
> Place a breakpoint at the deployment deletion and then slowly follow the 
> steps. During in a file browser the deletion can be seen.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to