-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat : upgrade software to latest versions #818
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b0372ae
feat : upgrade software to latest versions
rajadilipkolli 8f34249
attempt to use OOTB service connection for S3
rajadilipkolli ccff299
fix : issue with assiging dynamic properties
rajadilipkolli 4b69006
run all repo tests with testcontainers
rajadilipkolli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration": "automatic", | ||
"java.compile.nullAnalysis.mode": "automatic", | ||
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable" | ||
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable", | ||
"java.debug.settings.onBuildFailureProceed": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 5 additions & 37 deletions
42
aws-s3-project/src/test/java/com/learning/awspring/TestS3Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,14 @@ | ||
package com.learning.awspring; | ||
|
||
import com.learning.awspring.common.LocalStackContainerConfig; | ||
import com.learning.awspring.common.SQLContainerConfig; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.devtools.restart.RestartScope; | ||
import org.springframework.boot.test.context.TestConfiguration; | ||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.test.context.DynamicPropertyRegistry; | ||
import org.testcontainers.containers.PostgreSQLContainer; | ||
import org.testcontainers.containers.localstack.LocalStackContainer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.utility.DockerImageName; | ||
import org.testcontainers.utility.MountableFile; | ||
|
||
@TestConfiguration(proxyBeanMethods = false) | ||
public class TestS3Application { | ||
|
||
@Bean | ||
@ServiceConnection | ||
@RestartScope | ||
PostgreSQLContainer<?> postgresContainer() { | ||
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:17.0-alpine")) | ||
.withReuse(true); | ||
} | ||
|
||
@Bean | ||
LocalStackContainer localstackContainer(DynamicPropertyRegistry registry) { | ||
LocalStackContainer localStackContainer = | ||
new LocalStackContainer( | ||
DockerImageName.parse("localstack/localstack").withTag("3.7.2")) | ||
.withCopyFileToContainer( | ||
MountableFile.forHostPath(".localstack/"), | ||
"/etc/localstack/init/ready.d/") | ||
.waitingFor( | ||
Wait.forLogMessage(".*LocalStack initialized successfully\n", 1)); | ||
registry.add("spring.cloud.aws.credentials.access-key", localStackContainer::getAccessKey); | ||
registry.add("spring.cloud.aws.credentials.secret-key", localStackContainer::getSecretKey); | ||
registry.add("spring.cloud.aws.region.static", localStackContainer::getRegion); | ||
registry.add("spring.cloud.aws.endpoint", localStackContainer::getEndpoint); | ||
return localStackContainer; | ||
} | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.from(S3Application::main).with(TestS3Application.class).run(args); | ||
SpringApplication.from(S3Application::main) | ||
.with(SQLContainerConfig.class, LocalStackContainerConfig.class) | ||
.run(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
aws-s3-project/src/test/java/com/learning/awspring/common/LocalStackContainerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.learning.awspring.common; | ||
|
||
import org.springframework.boot.test.context.TestConfiguration; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.test.context.DynamicPropertyRegistrar; | ||
import org.testcontainers.containers.localstack.LocalStackContainer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.utility.DockerImageName; | ||
import org.testcontainers.utility.MountableFile; | ||
|
||
@TestConfiguration(proxyBeanMethods = false) | ||
public class LocalStackContainerConfig { | ||
|
||
@Bean | ||
LocalStackContainer localstackContainer() { | ||
return new LocalStackContainer( | ||
DockerImageName.parse("localstack/localstack").withTag("4.0.3")) | ||
.withCopyFileToContainer( | ||
MountableFile.forHostPath(".localstack/"), "/etc/localstack/init/ready.d/") | ||
.waitingFor(Wait.forLogMessage(".*LocalStack initialized successfully\n", 1)); | ||
} | ||
|
||
@Bean | ||
DynamicPropertyRegistrar dynamicPropertyRegistrar(LocalStackContainer localStackContainer) { | ||
return registry -> { | ||
registry.add( | ||
"spring.cloud.aws.credentials.access-key", localStackContainer::getAccessKey); | ||
registry.add( | ||
"spring.cloud.aws.credentials.secret-key", localStackContainer::getSecretKey); | ||
registry.add("spring.cloud.aws.region.static", localStackContainer::getRegion); | ||
registry.add("spring.cloud.aws.endpoint", localStackContainer::getEndpoint); | ||
}; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
aws-s3-project/src/test/java/com/learning/awspring/common/SQLContainerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.learning.awspring.common; | ||
|
||
import org.springframework.boot.devtools.restart.RestartScope; | ||
import org.springframework.boot.test.context.TestConfiguration; | ||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection; | ||
import org.springframework.context.annotation.Bean; | ||
import org.testcontainers.containers.PostgreSQLContainer; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
@TestConfiguration(proxyBeanMethods = false) | ||
public class SQLContainerConfig { | ||
|
||
@Bean | ||
@ServiceConnection | ||
@RestartScope | ||
PostgreSQLContainer<?> postgresContainer() { | ||
return new PostgreSQLContainer<>(DockerImageName.parse("postgres:17.2-alpine")) | ||
.withReuse(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Confirm database replacement strategy.
By default,
@AutoConfigureTestDatabase
may replace the configured database with an embedded one. If you intend to use your external container-based database, consider specifying@AutoConfigureTestDatabase(replace=AutoConfigureTestDatabase.Replace.NONE)
to avoid potential conflicts.📝 Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RabbitAI, from spring boot 3.4.x this is allowed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.