-
-
Notifications
You must be signed in to change notification settings - Fork 367
Closed
Description
Type: Bug
Component:
Testing
Describe the bug
The @Serviceconnection annotation only seems to work for the deprecated org.testcontainers.containers.localstack.LocalStackContainer class and not its replacement org.testcontainers.localstack.LocalStackContainer class in v2 of LocalStack
see #1500
Sample
package com.example.demo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;
// works v.1.21.3 of localstatck
// import org.testcontainers.containers.localstack.LocalStackContainer;
// doesnt work, v. 2.0.2 of localstack
import org.testcontainers.localstack.LocalStackContainer;
import org.testcontainers.utility.DockerImageName;
@SpringBootTest
class DemoApplicationTests {
@Test
void contextLoads() {
}
@TestConfiguration
static class TestConfig {
@Bean
@ServiceConnection
public LocalStackContainer localStackContainer() {
return new LocalStackContainer(DockerImageName.parse("localstack/localstack:4.10"));
}
}
}Metadata
Metadata
Assignees
Labels
No labels