mirror of
https://github.com/google/nomulus
synced 2026-06-02 04:56:39 +00:00
Restore original System Properties after tests
Many registry tools tests modify system properties but do not restore them to original state. These tests must be isolated from each other and cannot share the same test execution process. This has a huge impact on test performance under Gradle, which seems to have higher process startup overhead. Current Gradle test config has to set 'forEvery' to 1, i.e., every test class must be run in a freshly started process. This change significantly reduces the number of tests that need isolation, making it easier to optimize test config for the remaining tests. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=221350284
This commit is contained in:
@@ -21,7 +21,9 @@ import com.google.api.client.http.HttpRequest;
|
||||
import com.google.api.client.http.HttpRequestFactory;
|
||||
import com.google.api.client.http.HttpRequestInitializer;
|
||||
import google.registry.config.RegistryConfig;
|
||||
import google.registry.testing.SystemPropertyRule;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
@@ -40,11 +42,13 @@ public class DefaultRequestFactoryModuleTest {
|
||||
}
|
||||
});
|
||||
|
||||
@Rule public final SystemPropertyRule systemPropertyRule = new SystemPropertyRule();
|
||||
|
||||
DefaultRequestFactoryModule module = new DefaultRequestFactoryModule();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
RegistryToolEnvironment.UNITTEST.setup();
|
||||
RegistryToolEnvironment.UNITTEST.setup(systemPropertyRule);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user