Skip to content

Commit

Permalink
Support passing ARM image as compatible with default one
Browse files Browse the repository at this point in the history
  • Loading branch information
Iosif Zeldin authored and lpandzic committed May 14, 2024
1 parent 1e1f3df commit 4423623
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.infobip.testcontainers.spring.mssql;

import static org.testcontainers.containers.MSSQLServerContainer.IMAGE;
import static org.testcontainers.containers.MSSQLServerContainer.MS_SQL_SERVER_PORT;

import java.util.Arrays;
Expand All @@ -15,6 +16,7 @@
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.testcontainers.utility.DockerImageName;

public class MSSQLServerContainerInitializer extends InitializerBase<MSSQLServerContainerWrapper> {

Expand All @@ -28,8 +30,9 @@ public void initialize(ConfigurableApplicationContext applicationContext) {
var urlPropertyNames = getUrlPropertyNames(environment);
var urlPropertyNameToValue = getUrlPropertyNameToValue(environment, urlPropertyNames);
var wrapper = Optional.ofNullable(environment.getProperty("testcontainers.mssql.docker.image"))
.map(MSSQLServerContainerWrapper::new)
.orElseGet(MSSQLServerContainerWrapper::new);
.map((name)->DockerImageName.parse(name).asCompatibleSubstituteFor(IMAGE))
.map(MSSQLServerContainerWrapper::new)
.orElseGet(MSSQLServerContainerWrapper::new);
var container = handleReusable(wrapper);

var initScript = Optional.ofNullable(environment.getProperty("testcontainers.mssql.init-script"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
package com.infobip.testcontainers.spring.mssql;

import org.testcontainers.utility.DockerImageName;

public class MSSQLServerContainerWrapper
extends org.testcontainers.containers.MSSQLServerContainer<MSSQLServerContainerWrapper> {

@Deprecated
public MSSQLServerContainerWrapper() {
super(IMAGE + ":" + DEFAULT_TAG);
super();
}

public MSSQLServerContainerWrapper(String image) {
super(image);
}

public MSSQLServerContainerWrapper(DockerImageName dockerImageName) {
super(dockerImageName);
}

@Override
protected void configure() {
addEnv("ACCEPT_EULA", "Y");
Expand Down

0 comments on commit 4423623

Please sign in to comment.