mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 06:44:51 +02:00
Add filter support to the test server
The lack of ObjectifyFilter means that in any tests using RegistryTestServer the Objectify session cache persists between "requests" in the same test method. This is wrong but had not caused any failures because we didn't assert anything that mattered. However, a CL I'm working on asserts that there is a creationTime on a created resource, which is set automatically on Datastore save, and therefore is still null in the session cache's version of the resource if you don't clear it before the next command. Fixing it here separately from that CL. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=141939330
This commit is contained in:
parent
c281f54def
commit
5b9219fbdd
4 changed files with 29 additions and 9 deletions
|
@ -46,9 +46,9 @@ public final class NetworkUtils {
|
|||
/**
|
||||
* Returns random unused local port that can be used for TCP listening server.
|
||||
*
|
||||
* @throws IOException if failed to find free port after {@value #PICK_ATTEMPTS} attempts
|
||||
* @throws RuntimeException if failed to find free port after {@value #PICK_ATTEMPTS} attempts
|
||||
*/
|
||||
public static int pickUnusedPort() throws IOException {
|
||||
public static int pickUnusedPort() {
|
||||
// In an ideal world, we would just listen on port 0 and use whatever random port the kernel
|
||||
// assigns us. But our CI testing system reports there are rare circumstances in which this
|
||||
// doesn't work.
|
||||
|
@ -58,7 +58,7 @@ public final class NetworkUtils {
|
|||
return serverSocket.getLocalPort();
|
||||
} catch (IOException e) {
|
||||
if (!ports.hasNext()) {
|
||||
throw new IOException("Failed to acquire random port", e);
|
||||
throw new RuntimeException("Failed to acquire random port", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue