-
Notifications
You must be signed in to change notification settings - Fork 693
pubsub emulator rule moved to a separate project #2352
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2352 +/- ##
============================================
- Coverage 81.10% 74.04% -7.07%
+ Complexity 2315 2098 -217
============================================
Files 259 259
Lines 7563 7563
Branches 785 785
============================================
- Hits 6134 5600 -534
- Misses 1103 1603 +500
- Partials 326 360 +34
Continue to review full report at Codecov.
|
pom.xml
Outdated
@@ -45,6 +45,7 @@ | |||
<module>spring-cloud-gcp-bigquery</module> | |||
<module>spring-cloud-gcp-security-firebase</module> | |||
<module>spring-cloud-gcp-secretmanager</module> | |||
<module>spring-cloud-gcp-test-support</module> |
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.
Let's rename to spring-cloud-gcp-test
.
…o pubsub-emulator-rule
SonarCloud Quality Gate failed. 0 Bugs |
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> |
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.
test
scope?
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.
Not in this case -- the test project itself is meant to be imported as test scope, but the rule extends a JUnit class, so it needs to be compile, not test scope.
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.
I wonder if we should consider making these utilities independent of JUnit. People use different test frameworks.
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.
make it generic so people can reuse it sounds good. Can you take into account that may some people will be able to contribute creating rules for junit4 or extension for junit5 specifically? Those can be issues with ideal for contribution
or help wanted
. WDYT?
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.
That a good idea! We should do that.
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-jcl</artifactId> | ||
<scope>compile</scope> |
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.
Compile scope is the default, you don't have to specify it.
@@ -87,7 +86,7 @@ public PubSubEmulator() { | |||
@Override | |||
protected void before() throws IOException, InterruptedException { | |||
|
|||
assumeTrue("PubSubEmulator rule disabled. Please enable with -Dit.pubsub-emulator.", this.enableTests); | |||
Assume.assumeTrue("PubSubEmulator rule disabled. Please enable with -Dit.pubsub-emulator.", this.enableTests); |
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.
I don't think that enabling it with -Dit.pubsub-emulator
makes sense when you're offering it as a generic test utility. That flag was specific for our project.
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.
It's an interesting question then to test whether the rule initialization or a test's @BeforeClass
will run first. We would not want to do emulator startup if the tests themselves are disabled.
If there is possibility of the rule running first, perhaps we can just document this flag well?
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.
We can also try not to implement JUnit test rule.
That's what we ended up doing for Spring Cloud Function here.
@@ -14,7 +14,7 @@ | |||
* limitations under the License. | |||
*/ | |||
|
|||
package org.springframework.cloud.gcp.stream.binder.pubsub; | |||
package org.springframework.cloud.gcp.test; |
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.
package org.springframework.cloud.gcp.test; | |
package org.springframework.cloud.gcp.test.pubsub; |
superseded by #2357 |
fixes #2351
cc/ @elefeint