-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add first pact verification for WDS integration. #1511
Conversation
a53dd38
to
85c0a99
Compare
service/src/test/java/bio/terra/workspace/pact/WdsContractVerificationTest.java
Outdated
Show resolved
Hide resolved
85c0a99
to
4ad26d4
Compare
ef3a1fb
to
23c1d25
Compare
@@ -35,6 +34,8 @@ | |||
@Tag("pact-test") | |||
@ExtendWith(PactConsumerTestExt.class) | |||
public class TpsApiTest { | |||
private static final String UUID_REGEX = |
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.
As part of upgrading the pactjvm dep, we lost access to the UUID_REGEX
which was buried in an inaccessible kotlin companion object. This is just an inline of the String previously referenced.
scripts/write-config.sh
Outdated
@@ -322,6 +322,8 @@ landingzone: | |||
- [email protected] | |||
- [email protected] | |||
- [email protected] | |||
pactbroker: |
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 doesn't actually work to provide a local override -- the pactbroker.url defined in application-test.yml
ends up taking precedence, which is why to actually run locally I provided a screenshot of the runconfig needed to set the value via environment variable.
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.
if this doesn't work, then can you delete it? If it needs to be present for some reason, add a code comment explaining it doesn't have any effect.
service/gradle/testing.gradle
Outdated
// TODO: do the correct/idiomatic thing here with config values, help needed for WSM specifics, desired behavior: | ||
// default: use the dsp-eng-tools version | ||
// allow optional local-override for local pactbroker |
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.
For what it's worth, DataBiosphere/terra-workspace-data-service#364 does this in the config file: https://github.com/DataBiosphere/terra-workspace-data-service/pull/364/files#diff-cc6240f713f8c21e8355ffde96d288c175673fec877cc6b1b0f0ebd0edda5e57
23c1d25
to
4871397
Compare
WdsContractVerificationTest
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 file is copied from DataBiosphere/jade-data-repo#1528, I'll annotate the lines which are WSM-specific.
4871397
to
742f618
Compare
@@ -0,0 +1,203 @@ | |||
name: Verify consumer pacts | |||
# The purpose of this workflow is to verify ANY consumer contract(s) dependent on workspacemanager provider using Pact |
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.
Comment adjusted to include workspacemanager
pacticipant name, which must match the helmchart name.
# - PACT_BROKER_USERNAME - the Pact Broker username | ||
# - PACT_BROKER_PASSWORD - the Pact Broker password | ||
# They are managed by Atlantis and were added to Terraform here: | ||
# https://github.com/broadinstitute/terraform-ap-deployments/pull/1086 |
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.
Included link to PR where wsm's creds were introduced.
# https://github.com/broadinstitute/terraform-ap-deployments/pull/1086 | ||
env: | ||
PACT_BROKER_URL: pact-broker.dsp-eng-tools.broadinstitute.org | ||
spring_profiles_active: human-readable-logging |
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.
Added spring_profiles_active
to get human friendly logs, which are important to interpreting pact verification failures.
958eba3
to
d1dbe5d
Compare
repo: broadinstitute/terra-github-workflows | ||
ref: refs/heads/main | ||
token: ${{ secrets.BROADBOT_TOKEN }} # github token for access to kick off a job in the private repo | ||
inputs: '{ "pacticipant": "workspacemanager", "version": "${{ needs.verify-consumer-pact.outputs.provider-sha }}" }' |
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.
Adjusted pacticipant name to workspacemanager
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
2975f37
to
b3e06b4
Compare
d1dbe5d
to
6fa0e93
Compare
a4d3630
to
83e7061
Compare
0fea0b2
to
0e115d9
Compare
This pairs with DataBiosphere/terra-workspace-data-service#372 to establish a contract between WDS and WSM, initially focused on `ReferencedGcpResourceController`.
REVERT: Attempt to upload results of pact Debug level logging to troubleshoot pact
e417090
to
c743aba
Compare
Prefer helmchart name as the pacticipant identifier: * `bpm-provider` -> `bpm` * `bpm-consumer` -> `bpm` * `sam-provider` -> `sam` * See [thread](https://broadinstitute.slack.com/archives/C043YJ40719/p1698068076950019) discussing the `-consumer` and `-provider` suffix anti-pattern. * See [thread](https://broadinstitute.slack.com/archives/C043YJ40719/p1698241095600099) discussing the recommendation to use the helm chart name. Unblocks: * broadinstitute/rawls#2610 * DataBiosphere/terra-workspace-manager#1511 * broadinstitute/sam#1234
Discussed offline with @blakery, a couple things to incorporate into this PR for next round:
|
03effa5
to
49705f6
Compare
This will allow the `@State` to better track stateful behavior, and hopefully prevent future collision/disagreement between stateful setups that might happen when mocking at the service level.
49705f6
to
00b1917
Compare
@Tag("pact-verification") | ||
@Provider("workspacemanager") // should match the terra chart name | ||
@PactBroker() | ||
public class WdsContractVerificationTest extends BaseUnitTestMocks { |
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'm really surprised by how well pushing the mocks lower worked!
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.
Agreed...I was pleasantly surprised that extending from BaseUnitTestMocks
seemed to strike the right balance of dependencies that I didn't have to @MockBean
out everything into oblivion.
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.
A few comments inline, nothing big. Thanks for doing this!
I did not test any of this myself, but I see the checks passing.
scripts/write-config.sh
Outdated
@@ -322,6 +322,8 @@ landingzone: | |||
- [email protected] | |||
- [email protected] | |||
- [email protected] | |||
pactbroker: |
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.
if this doesn't work, then can you delete it? If it needs to be present for some reason, add a code comment explaining it doesn't have any effect.
# This workflow is triggered when | ||
# | ||
# 1. Consumer makes a change that results in a new pact published to Pact Broker (will verify ONLY the changed pact and publish the verification results back to the broker) | ||
# 2. Provider makes a change (runs verification tests against ALL DEPLOYED consumer pact versions and publishes corresponding verification results) |
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.
ALL DEPLOYED consumer pact versions
doesn't this require some configuration/integration with beehive or sherlock? Is this already set up?
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.
Honestly, I'm not sure...this file is the result of a blatant copypaste. I did check in https://beehive.dsp-devops.broadinstitute.org/charts/workspacemanager/contract-testing and confirmed that for workspacemanager
contract testing is enabled:
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'll get to exercise some of the provider side again after this merges by integrating another couple pact verifications...hopefully I'll have more of a clue after that process.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This is followup after: #1511 That PR (and associated changes) introduced the first WDS <-> WSM pact verification to WSM, but inadvertently broke the `verify_consumer_pacts` GitHub action in the process. This PR fixes that, while also adopting semantic versioning for reporting verification to Pact Broker. Various relevant threads: * https://broadinstitute.slack.com/archives/C043YJ40719/p1699888771297559 * https://broadinstitute.slack.com/archives/C043YJ40719/p1700155493619189 * https://broadinstitute.slack.com/archives/C043YJ40719/p1700154543175189 GitHub Actions logic copied from: DataBiosphere/terra-billing-profile-manager#324
This is followup after: #1511 That PR (and associated changes) introduced the first WDS <-> WSM pact verification to WSM, but inadvertently broke the `verify_consumer_pacts` GitHub action in the process. This PR fixes that, while also adopting semantic versioning for reporting verification to Pact Broker. Various relevant threads: * https://broadinstitute.slack.com/archives/C043YJ40719/p1699888771297559 * https://broadinstitute.slack.com/archives/C043YJ40719/p1700155493619189 * https://broadinstitute.slack.com/archives/C043YJ40719/p1700154543175189 GitHub Actions logic copied from: DataBiosphere/terra-billing-profile-manager#324
* Fix `verify_consumer_pacts` GitHub action. This is followup after: #1511 That PR (and associated changes) introduced the first WDS <-> WSM pact verification to WSM, but inadvertently broke the `verify_consumer_pacts` GitHub action in the process. This PR fixes that, while also adopting semantic versioning for reporting verification to Pact Broker. Various relevant threads: * https://broadinstitute.slack.com/archives/C043YJ40719/p1699888771297559 * https://broadinstitute.slack.com/archives/C043YJ40719/p1700155493619189 * https://broadinstitute.slack.com/archives/C043YJ40719/p1700154543175189 GitHub Actions logic copied from: DataBiosphere/terra-billing-profile-manager#324 Also enable pending pacts. See: https://docs.pact.io/pact_broker/advanced_topics/pending_pacts --------- Co-authored-by: Ivan <[email protected]>
This pairs with DataBiosphere/terra-workspace-data-service#372 to establish a contract between WDS and WSM, initially focused on
ReferencedGcpResourceController
.I tested this running a local pact-broker by following the steps in this doc and using the displayed IntelliJ run configuration: