mirror of
https://github.com/google/nomulus
synced 2026-06-03 13:36:41 +00:00
Make a best effort attempt to support multiple CPU architectures (#2672)
I obtained access to an IBM s390x VM so I thought I'd see how multi-arch Nomulus is. Our main application is in Java so it is already multi-arch, but several tests use docker images that are by default x64. Luckily postgres has an s390x port, but selenium does not. So I had to disable Screenshot tests when the arch is not amd64.
This commit is contained in:
@@ -38,7 +38,7 @@ class HibernateSchemaExporterTest {
|
||||
|
||||
@Container
|
||||
private static final PostgreSQLContainer database =
|
||||
new PostgreSQLContainer(NomulusPostgreSql.getDockerTag());
|
||||
new PostgreSQLContainer(NomulusPostgreSql.getDockerImageName());
|
||||
|
||||
private static HibernateSchemaExporter exporter;
|
||||
|
||||
@@ -61,12 +61,12 @@ class HibernateSchemaExporterTest {
|
||||
.isEqualTo(
|
||||
"""
|
||||
|
||||
create table "TestEntity" (
|
||||
name text not null,
|
||||
cu text,
|
||||
primary key (name)
|
||||
);
|
||||
"""
|
||||
create table "TestEntity" (
|
||||
name text not null,
|
||||
cu text,
|
||||
primary key (name)
|
||||
);
|
||||
"""
|
||||
.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class PersistenceModuleTest {
|
||||
|
||||
@Container
|
||||
private final PostgreSQLContainer database =
|
||||
new PostgreSQLContainer(NomulusPostgreSql.getDockerTag());
|
||||
new PostgreSQLContainer(NomulusPostgreSql.getDockerImageName());
|
||||
|
||||
private EntityManagerFactory emf;
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ public abstract class JpaTransactionManagerExtension
|
||||
|
||||
private static JdbcDatabaseContainer<?> create() {
|
||||
PostgreSQLContainer<?> container =
|
||||
new PostgreSQLContainer<>(NomulusPostgreSql.getDockerTag())
|
||||
new PostgreSQLContainer<>(NomulusPostgreSql.getDockerImageName())
|
||||
.withDatabaseName(POSTGRES_DB_NAME);
|
||||
container.start();
|
||||
return container;
|
||||
|
||||
@@ -39,7 +39,7 @@ class GenerateSqlSchemaCommandTest extends CommandTestCase<GenerateSqlSchemaComm
|
||||
|
||||
@Container
|
||||
private static final PostgreSQLContainer<?> postgres =
|
||||
new PostgreSQLContainer<>(NomulusPostgreSql.getDockerTag())
|
||||
new PostgreSQLContainer<>(NomulusPostgreSql.getDockerImageName())
|
||||
.withDatabaseName("postgres")
|
||||
.withUsername("postgres")
|
||||
.withPassword("domain-registry");
|
||||
|
||||
@@ -23,6 +23,7 @@ import google.registry.model.console.RegistrarRole;
|
||||
import google.registry.server.RegistryTestServer;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import org.junitpioneer.jupiter.RetryingTest;
|
||||
import org.openqa.selenium.By;
|
||||
@@ -47,6 +48,8 @@ import org.openqa.selenium.WebElement;
|
||||
* the color fading over a short period of time. We must wait for the highlighting to fade to get
|
||||
* cnosistent images to avoid spurious failures.
|
||||
*/
|
||||
// The Selenium image only supports amd64 architecture.
|
||||
@EnabledIfSystemProperty(named = "os.arch", matches = "amd64")
|
||||
public class ConsoleScreenshotTest extends WebDriverTestCase {
|
||||
|
||||
@RegisterExtension
|
||||
|
||||
@@ -37,7 +37,11 @@ class DockerWebDriverExtension implements BeforeAllCallback, AfterAllCallback {
|
||||
// This port number is defined in this Dockerfile:
|
||||
// https://github.com/SeleniumHQ/docker-selenium/blob/master/StandaloneChrome/Dockerfile#L21
|
||||
private static final int CHROME_DRIVER_SERVICE_PORT = 4444;
|
||||
private static final URL WEB_DRIVER_URL = getWebDriverUrl();
|
||||
// The selenium image only supports amd64 architecture. We disable the call to getWebDriverUrl()
|
||||
// here as the extension is instantiated in the test class before the test runner had a chance to
|
||||
// disable the tests.
|
||||
private static final URL WEB_DRIVER_URL =
|
||||
System.getProperty("os.arch").equals("amd64") ? getWebDriverUrl() : null;
|
||||
private WebDriver webDriver;
|
||||
|
||||
private static URL getWebDriverUrl() {
|
||||
|
||||
Reference in New Issue
Block a user