Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions console-webapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ task runConsoleWebappUnitTests(type: Exec) {

task buildConsoleWebapp(type: Exec) {
workingDir "${consoleDir}/"
executable 'npm'
executable 'npx'
def configuration = project.getProperty('configuration')
args 'run', "build", "--configuration=${configuration}"
args 'ng', 'build', '--base-href=/console/', "--configuration=${configuration}", "--output-path=staged/dist"
doFirst {
println "Building console for environment: ${configuration}"
}
Expand All @@ -52,18 +52,11 @@ task buildConsoleForAll() {}
def createConsoleTask = { env ->
project.tasks.register("buildConsoleFor${env.capitalize()}", Exec) {
workingDir "${consoleDir}/"
executable 'npm'
args 'run', 'build', "--configuration=${env}"
executable 'npx'
args 'ng', 'build', '--base-href=/console/', "--configuration=${env}", "--output-path=staged/console-${env}"
doFirst {
println "Building console for environment: ${env}"
}
doLast {
copy {
from "${consoleDir}/staged/dist/"
into "${consoleDir}/staged/console-${env}"
}
delete "${consoleDir}/staged/dist"
}
dependsOn(tasks.npmInstallDeps)
}
project.tasks.register("deleteConsoleFor${env.capitalize()}", Delete) {
Expand All @@ -81,14 +74,6 @@ def createConsoleTask = { env ->
createConsoleTask(env)
}

// Force an order so we don't run these tasks in parallel.
tasks.buildConsoleForCrash.mustRunAfter(tasks.buildConsoleForAlpha)
tasks.buildConsoleForQa.mustRunAfter(tasks.buildConsoleForCrash)
tasks.buildConsoleForSandbox.mustRunAfter(tasks.buildConsoleForQa)
tasks.buildConsoleForProduction.mustRunAfter(tasks.buildConsoleForSandbox)
// This task must run last, otherwise the previous tasks will have deleted the "dist" folder.
tasks.buildConsoleWebapp.mustRunAfter(tasks.buildConsoleForProduction)

task applyFormatting(type: Exec) {
workingDir "${consoleDir}/"
executable 'npm'
Expand Down
17 changes: 3 additions & 14 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,7 @@ def dockerIncompatibleTestPatterns = [
// affected by global states outside of Nomulus classes, e.g., threads and
// objects retained by frameworks.
// TODO(weiminyu): identify cause and fix offending tests.
def fragileTestPatterns = [
// Breaks random other tests when running with standardTests.
"google/registry/bsa/UploadBsaUnavailableDomainsActionTest.*",
// Currently changes a global configuration parameter that for some reason
// results in timestamp inversions for other tests. TODO(mmuller): fix.
"google/registry/flows/host/HostInfoFlowTest.*",
"google/registry/beam/common/RegistryPipelineWorkerInitializerTest.*",
] + dockerIncompatibleTestPatterns
def fragileTestPatterns = dockerIncompatibleTestPatterns

sourceSets {
main {
Expand Down Expand Up @@ -751,13 +744,9 @@ test {
// Don't run any tests from this task, all testing gets done in the
// FilteringTest tasks.
exclude "**"
// TODO(weiminyu): Remove dependency on sqlIntegrationTest
}.dependsOn(fragileTest, standardTest, registryToolIntegrationTest, sqlIntegrationTest)
}.dependsOn(standardTest, registryToolIntegrationTest)

// When we override tests, we also break the cleanTest command.
cleanTest.dependsOn(cleanFragileTest, cleanStandardTest,
cleanRegistryToolIntegrationTest, cleanSqlIntegrationTest)
cleanTest.dependsOn(cleanStandardTest, cleanRegistryToolIntegrationTest)

project.build.dependsOn devtool
project.build.dependsOn buildToolImage
project.build.dependsOn ':stage'
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static google.registry.testing.LogsSubject.assertAboutLogs;
import static google.registry.util.DateTimeUtils.START_INSTANT;
import static google.registry.util.DateTimeUtils.minusDays;
import static google.registry.util.NetworkUtils.pickUnusedPort;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
import static org.mockito.Mockito.times;
Expand Down Expand Up @@ -168,7 +167,7 @@ void uploadToBsaTest() throws Exception {
private TestServer startTestServer() throws Exception {
TestServer testServer =
new TestServer(
HostAndPort.fromParts(InetAddress.getLocalHost().getHostAddress(), pickUnusedPort()),
HostAndPort.fromParts(InetAddress.getLocalHost().getHostAddress(), 0),
ImmutableMap.of(),
ImmutableList.of(Route.route("/upload", Servlet.class)));
testServer.start();
Expand Down
31 changes: 21 additions & 10 deletions core/src/test/java/google/registry/server/TestServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import jakarta.servlet.http.HttpServlet;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -138,30 +140,39 @@ public void stop() {
.callWithTimeout(
() -> {
server.stop();
RegistryEnvironment.setIsInTestDriver(false);
return null;
},
SHUTDOWN_TIMEOUT_MS,
TimeUnit.MILLISECONDS);
for (var dir : multiPartTmpDirs) {
try {
Files.delete(dir);
} catch (Exception e) {
// Ignore
}
}
} catch (Exception e) {
throwIfUnchecked(e);
throw new RuntimeException(e);
} finally {
RegistryEnvironment.setIsInTestDriver(false);
}
for (var dir : multiPartTmpDirs) {
try {
Files.delete(dir);
} catch (IOException e) {
// Nothing we can do
}
}
}

public int getPort() {
return ((ServerConnector) server.getConnectors()[0]).getLocalPort();
}

/** Returns a URL that can be used to communicate with this server. */
public URL getUrl(String path) {
checkArgument(path.startsWith("/"), "Path must start with a slash: %s", path);
try {
return new URL(String.format("http://%s%s", urlAddress, path));
} catch (MalformedURLException e) {
int port = getPort();
if (port <= 0) {
port = urlAddress.getPortOrDefault(DEFAULT_PORT);
}
return new URI(String.format("http://%s:%d%s", urlAddress.getHost(), port, path)).toURL();
} catch (MalformedURLException | URISyntaxException e) {
throw new RuntimeException(e);
}
}
Expand Down
1 change: 0 additions & 1 deletion jetty/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,4 @@ tasks.register('getEndpoints', Exec) {
commandLine './get-endpoints.py', "${rootProject.gcpProject}"
}

project.build.dependsOn(tasks.named('buildNomulusImage'))
rootProject.deploy.dependsOn(tasks.named('deployNomulus'))
Loading