-
Notifications
You must be signed in to change notification settings - Fork 0
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
STNG-165 Run one scenario in AWS dev fully end-to-end #182
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
948708a
STNG-165 Run one scenario fully end-to-end in AWS dev environment
jkosternl d10367a
Add delays and waits to wait all async calls are fully processed
jkosternl 2fd390a
Make maven-surefire-plugin skip both WebUI and Integration tests by d…
jkosternl 8f84161
Add used environment variables to the build. Retrieve all vars from e…
jkosternl cfbe4da
Test this PR by allowing to deploy to AWS and verify the test runs
jkosternl 1bf6b05
Check why GitHub Action skips all tests, while a local run with exact…
jkosternl c039d4d
No clue why Maven in GH skips my new unit tests. Do some experiments...
jkosternl 653ce52
Getting crazy. GH build ignores even pluginManagement. Add all the lo…
jkosternl 5319ba6
Add some strange suggestion of GitHub CoPilot, because the sky is blue.
jkosternl ce3d8a0
Add some strange suggestion of GitHub CoPilot, because the sky is gray.
jkosternl 71a682d
Try out the configuration as well in the build-plugins section
jkosternl 7ccbdc1
Use Maven Profiles to fix different build behavior in GitHub vs laptop
jkosternl 1540834
Fix the differences in checkout :-( probably fixing all the weird beh…
jkosternl 9e87cce
Restore previous behaviour to test everything together
jkosternl ed9bce9
Restore original build behaviour for PRs and deploying to AWS
jkosternl 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,6 @@ | |
<junit.version>5.11.1</junit.version> | ||
<lombok.version>1.18.34</lombok.version> | ||
|
||
<junit.includedTags>!WebUI</junit.includedTags> | ||
|
||
<sonar.host.url>https://sonarcloud.io</sonar.host.url> | ||
<sonar.organization>dcsaorg</sonar.organization> | ||
<sonar.projectKey>Conformance-Gateway</sonar.projectKey> | ||
|
@@ -150,10 +148,36 @@ | |
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<profiles> | ||
<profile> | ||
<id>default</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<properties> | ||
<junit.includedTags/> | ||
<junit.excludedTags>WebUI,Integration</junit.excludedTags> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>webui</id> | ||
<properties> | ||
<junit.includedTags>WebUI</junit.includedTags> | ||
<junit.excludedTags>Integration</junit.excludedTags> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>integration</id> | ||
<properties> | ||
<junit.includedTags>Integration</junit.includedTags> | ||
<junit.excludedTags>WebUI</junit.excludedTags> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I introduced profiles to make it more clear and easy to use and select which profile you'd like to use. By default, the first profile is used. |
||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
|
@@ -229,9 +253,10 @@ | |
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>3.5.0</version> | ||
<version>3.5.1</version> | ||
<configuration> | ||
<groups>${junit.includedTags}</groups> | ||
<excludedGroups>${junit.excludedTags}</excludedGroups> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
|
69 changes: 69 additions & 0 deletions
69
spring-boot/src/test/java/org/dcsa/conformance/frontend/AWSEnvironmentTest.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,69 @@ | ||
package org.dcsa.conformance.frontend; | ||
|
||
import java.time.Duration; | ||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.commons.lang3.time.StopWatch; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@Slf4j | ||
@Tag("Integration") | ||
class AWSEnvironmentTest extends SeleniumTestBase { | ||
private static final String ENV_BASE_URL = "TEST_BASE_URL"; | ||
private static final String ENV_LOGIN_EMAIL = "TEST_LOGIN_EMAIL"; | ||
private static final String ENV_LOGIN_PASSWORD = "TEST_LOGIN_PASSWORD"; | ||
|
||
@Override | ||
@BeforeEach | ||
public void setUp() { | ||
// Browsing in AWS is slow, so we need to increase the timeouts | ||
driver.manage().timeouts().implicitlyWait(Duration.ofMillis(WAIT_BEFORE_TIMEOUT_IN_MILLIS * 6)); | ||
wait.withTimeout(Duration.ofSeconds(20L)); | ||
stopAfterFirstScenarioGroup = true; | ||
lambdaDelay = 2_000L; // Not adding delays, but accept to wait longer sometimes. | ||
} | ||
|
||
@Test | ||
void testStandardOnDevEnvironment() { | ||
baseUrl = getRequiredProperty(ENV_BASE_URL); | ||
loginEmail = getRequiredProperty(ENV_LOGIN_EMAIL); | ||
loginPassword = getRequiredProperty(ENV_LOGIN_PASSWORD); | ||
|
||
StopWatch stopWatch = StopWatch.createStarted(); | ||
String standardName = "Ebl"; | ||
createSandboxesAndRunGroups( | ||
new Standard(standardName, null), "3.0.0", "Conformance TD-only", "Carrier"); | ||
log.info("Finished AWS testing on standard: {}, time taken: {}", standardName, stopWatch); | ||
} | ||
|
||
// Prevent sandbox names from clashing with existing sandboxes in AWS, by adding a date-timestamp | ||
@Override | ||
protected String getSandboxName( | ||
String standardName, String version, String suiteName, String roleName, int sandboxType) { | ||
String dateTimeFormatted = | ||
LocalDateTime.now() | ||
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss ")); // Keep space at end | ||
return dateTimeFormatted | ||
+ super.getSandboxName(standardName, version, suiteName, roleName, sandboxType); | ||
} | ||
|
||
private String getRequiredProperty(String environmentProperty) { | ||
String value = | ||
System.getenv().getOrDefault(environmentProperty, null); // Try system property first | ||
if (value == null) { | ||
// When it fails, also check the passed -Dkey=value properties | ||
value = System.getProperty(environmentProperty, null); | ||
} | ||
|
||
if (StringUtils.isBlank(value)) { | ||
throw new IllegalArgumentException( | ||
"Variable '%s' must be set, as an environment variable or supplied with -Dkey=value parameter." | ||
.formatted(environmentProperty)); | ||
} | ||
return value; | ||
} | ||
} |
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.
This was a pain.. I was making experimental changes in the
pom.xml
file for the new situation, but they were not applied, because I changed the checkout here to force it todev
HEAD instead.The enforcing of the right environment is also already guaranteed by line 5 and line 10 of this file.