pubsub emulator rule moved to a separate project#2352
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
| <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.
Let's rename to spring-cloud-gcp-test.
…o pubsub-emulator-rule
|
SonarCloud Quality Gate failed.
|
| <dependencies> | ||
| <dependency> | ||
| <groupId>junit</groupId> | ||
| <artifactId>junit</artifactId> |
There was a problem hiding this comment.
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.
I wonder if we should consider making these utilities independent of JUnit. People use different test frameworks.
There was a problem hiding this comment.
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.
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.
Compile scope is the default, you don't have to specify it.
| 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.
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.
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.
We can also try not to implement JUnit test rule.
That's what we ended up doing for Spring Cloud Function here.
| */ | ||
|
|
||
| package org.springframework.cloud.gcp.stream.binder.pubsub; | ||
| package org.springframework.cloud.gcp.test; |
There was a problem hiding this comment.
| package org.springframework.cloud.gcp.test; | |
| package org.springframework.cloud.gcp.test.pubsub; |
|
superseded by #2357 |
fixes #2351
cc/ @elefeint