-
Notifications
You must be signed in to change notification settings - Fork 228
Bolt micronaut/micronaut 4 upgrade #1294
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
Changes from all commits
b9b185b
1d3d4e7
0800da6
fa8f6fc
4d19dd6
5121dfe
bf07bcb
25bc7ac
9f296ab
5d6afdc
0e03acc
ad42fb4
acb7790
ae8c66c
734749c
835d9bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: JDK 17 Build & Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 12 | ||
| strategy: | ||
| matrix: | ||
| java-version: ['17'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Install JDK | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| java-version: ${{ matrix.java-version }} | ||
| distribution: 'adopt' | ||
| - name: Run all tests | ||
| run: | | ||
| ./scripts/run_no_prep_tests.sh -ci | ||
| env: | ||
| SKIP_UNSTABLE_TESTS: 1 | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| fail_ci_if_error: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| import io.micronaut.test.annotation.MockBean; | ||
| import io.micronaut.test.extensions.junit5.annotation.MicronautTest; | ||
| import jakarta.inject.Inject; | ||
| import jakarta.inject.Singleton; | ||
| import org.junit.jupiter.api.Assertions; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
|
|
@@ -51,7 +52,7 @@ public class CommandsTest { | |
| SlackSignature.Generator signatureGenerator = new SlackSignature.Generator(signingSecret); | ||
|
|
||
| @Primary | ||
| @MockBean(AppConfig.class) | ||
|
Contributor
Author
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. This seemed to be the issue with the test locally. I debugged and tracked the issue down eventually and I believe there was an issue where this was being treated as a mock but the bean that was returned wasn't actually a mock, so I just made this a normal singleton and it seems to have fixed the issue. Partially found this as I also just ran the application locally and was able to properly instantiate the controller that was having issues in the test, main difference being the AppConfig bean so figured it had to be around that. |
||
| @Singleton | ||
| AppConfig mockSlackAppConfig() throws IOException, SlackApiException { | ||
| AppConfig config = AppConfig.builder().signingSecret(signingSecret).singleTeamBotToken(botToken).build(); | ||
| config.setSlack(mockSlack()); | ||
|
|
@@ -76,7 +77,7 @@ Slack mockSlack() throws IOException, SlackApiException { | |
| public void command() { | ||
| MutableHttpRequest<String> request = HttpRequest.POST("/slack/events", ""); | ||
| request.header("Content-Type", "application/x-www-form-urlencoded"); | ||
| String timestamp = "" + (System.currentTimeMillis() / 1000); | ||
| String timestamp = String.valueOf(System.currentTimeMillis() / 1000); | ||
|
Contributor
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. Thanks, looks good to me |
||
| request.header(SlackSignature.HeaderNames.X_SLACK_REQUEST_TIMESTAMP, timestamp); | ||
| String signature = signatureGenerator.generate(timestamp, helloBody); | ||
| request.header(SlackSignature.HeaderNames.X_SLACK_SIGNATURE, signature); | ||
|
|
@@ -90,7 +91,7 @@ public void command() { | |
| public void invalidSignature() { | ||
| MutableHttpRequest<String> request = HttpRequest.POST("/slack/events", ""); | ||
| request.header("Content-Type", "application/x-www-form-urlencoded"); | ||
| String timestamp = "" + (System.currentTimeMillis() / 1000 - 30 * 60); | ||
| String timestamp = String.valueOf(System.currentTimeMillis() / 1000 - 30 * 60); | ||
| request.header(SlackSignature.HeaderNames.X_SLACK_REQUEST_TIMESTAMP, timestamp); | ||
| String signature = signatureGenerator.generate(timestamp, helloBody); | ||
| request.header(SlackSignature.HeaderNames.X_SLACK_SIGNATURE, signature); | ||
|
|
@@ -122,7 +123,7 @@ public void invalidSignature() { | |
| public void regexp_matching() { | ||
| MutableHttpRequest<String> request = HttpRequest.POST("/slack/events", ""); | ||
| request.header("Content-Type", "application/x-www-form-urlencoded"); | ||
| String timestamp = "" + (System.currentTimeMillis() / 1000); | ||
| String timestamp = String.valueOf(System.currentTimeMillis() / 1000); | ||
| request.header(SlackSignature.HeaderNames.X_SLACK_REQUEST_TIMESTAMP, timestamp); | ||
| String signature = signatureGenerator.generate(timestamp, submissionBody); | ||
| request.header(SlackSignature.HeaderNames.X_SLACK_SIGNATURE, signature); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package test_locally.app; | ||
|
|
||
| import io.micronaut.core.version.VersionUtils; | ||
| import io.micronaut.test.extensions.junit5.annotation.MicronautTest; | ||
| import org.junit.jupiter.api.Assertions; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| @MicronautTest | ||
| public class MicronautVersionTest { | ||
|
|
||
| @Test | ||
| public void expectedMicronautVersion() { | ||
| String version = VersionUtils.getMicronautVersion(); | ||
| Assertions.assertEquals("4.3.12", version); | ||
| } | ||
|
|
||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ flags() | |
| flags "$@" | ||
|
|
||
| is_jdk_8=`echo $JAVA_HOME | grep 8.` | ||
| is_jdk_14=`echo $JAVA_HOME | grep 14.` | ||
|
Contributor
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.
Contributor
Author
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. At a quick glance, that issue may be similar to what I called out here. I'll go with checking
Contributor
Author
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. Actually, since
Contributor
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. My understanding is that compiling all the modules never fails even with JDK 17 while some of them can fail when executing their test code. Thus, it should be feasible to compile slack-api-client (and others) and run only bolt-micronaut tests for now.
Contributor
Author
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. Ive got the
Contributor
Author
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. tried something new: added a new profile for when building with jdk17 to configure the surefire plugin to add the necessary I tried with just changing command line arguments but I could not seem to quite figure out how to get maven to just compile the dependencies needed for bolt-micronaut and not run the tests for them in the process.
Contributor
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. @hrothwell Indeed, there is no simple way to do it, so I came up with a solution to do
Contributor
Author
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 thought the changes in the base
Contributor
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. Oh I see. Will check if it works for me too later on!
Contributor
Author
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 did open #1296 which is the same changes I had originally so you wouldn't have to make the same changes again if you wanted to test it at all 👍 |
||
|
|
||
| is_travis_jdk_8=`echo $TRAVIS_JDK | grep openjdk8` | ||
| if [[ "${is_jdk_8}" != "" && "${is_travis_jdk_8}" != "" ]]; | ||
| then | ||
|
|
@@ -25,20 +27,32 @@ then | |
| -pl !bolt-quarkus-examples \ | ||
| -pl !bolt-jakarta-servlet \ | ||
| -pl !bolt-jakarta-jetty \ | ||
| -pl !bolt-micronaut \ | ||
| clean \ | ||
| test-compile \ | ||
| '-Dtest=test_locally.**.*Test' -Dsurefire.failIfNoSpecifiedTests=false test ${CI_OPTIONS}\ | ||
| '-Dtest=test_locally.**.*Test' -Dsurefire.failIfNoSpecifiedTests=false test ${CI_OPTIONS} \ | ||
| -DfailIfNoTests=false \ | ||
| -Dhttps.protocols=TLSv1.2 \ | ||
| --no-transfer-progress && \ | ||
| if git status --porcelain | grep .; then git --no-pager diff; exit 1; fi | ||
| else | ||
| elif [[ "${is_jdk_14}" != "" ]]; | ||
| then | ||
| ./mvnw ${MAVEN_OPTS} \ | ||
| -pl !bolt-micronaut \ | ||
| clean \ | ||
| test-compile \ | ||
| '-Dtest=test_locally.**.*Test' -Dsurefire.failIfNoSpecifiedTests=false test ${CI_OPTIONS} \ | ||
| -DfailIfNoTests=false \ | ||
| -Dhttps.protocols=TLSv1.2 \ | ||
| --no-transfer-progress && \ | ||
| if git status --porcelain | grep .; then git --no-pager diff; exit 1; fi | ||
| else | ||
| ./mvnw ${MAVEN_OPTS} \ | ||
| clean \ | ||
| test-compile \ | ||
| '-Dtest=test_locally.**.*Test' -Dsurefire.failIfNoSpecifiedTests=false test ${CI_OPTIONS} \ | ||
| -DfailIfNoTests=false \ | ||
| -Dhttps.protocols=TLSv1.2 \ | ||
| --no-transfer-progress && \ | ||
| if git status --porcelain | grep .; then git --no-pager diff; exit 1; fi | ||
| fi | ||
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.
issue in MN 4 - micronaut-projects/micronaut-core#9694
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.
ok, thanks for the workaround