@Test
  public void locatorStartsOnEphemeralPort() throws IOException {
    Properties configProperties = new Properties();
    configProperties.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
    configProperties.setProperty(HTTP_SERVICE_PORT, "0");
    configProperties.setProperty(JMX_MANAGER, "false");
    configProperties.setProperty(LOG_FILE, "");
    configProperties.setProperty(MCAST_PORT, "0");

    locator = Locator.startLocatorAndDS(0, null, configProperties);

    port = locator.getPort();
    assertThat(port).isNotZero();
  }
Fix: locator creates "locator0view.dat" file when started with port 0
geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorIntegrationTest.java