geode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Schuchardt <bschucha...@pivotal.io>
Subject many tests are misusing DistributedTestUtils.deleteLocatorStateFile()
Date Mon, 12 Aug 2019 17:01:13 GMT
*tl;dr**: invoke this method in the VM in which you're going to create 
your locator*

Rolling upgrade tests that want to ensure that old locator state files 
have been deleted are using this method incorrectly.

It's very common to see a rolling upgrade test delete old locator state 
files during setup.  You'll see something like this:

     int locatorPort = AvailablePort.getRandomAvailablePort();

     DistributedTestUtils.deleteLocatorStateFile(locatorPort);

This keeps old files created by previously run tests from infecting this 
test.  However, this use of the method doesn't work.

The problem is that DUnitLauncher runs each VM in its own directory.  
Deleting a file in the current working directory of the VM driving the 
test won't find a file in your locator's working directory.  You've got 
to delete that file in the context of the process you're going to use to 
host the locator.

     VM locatorVM = Host.getHost(0).getVM(oldVersion, 0);

     int port = AvailablePortHelper.getRandomAvailablePort();

*  locatorVM.invoke("delete state file", () -> 
*DistributedTestUtils.deleteLocatorStateFile(locatorPort)*);*



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message