|
51 | 51 | help='The duration in seconds we should wait to confirm verification' |
52 | 52 | ' process was successful. Defaults to 30.', |
53 | 53 | type=int) |
| 54 | +@click.option( |
| 55 | + 'provider_app_version', '-a', '--provider-app-version', |
| 56 | + help='The provider application version, required for publishing verification results' |
| 57 | + ) |
| 58 | +@click.option( |
| 59 | + 'publish_verification_results', '-r', '--publish-verification-results', |
| 60 | + default=False, |
| 61 | + help='Publish verification results to the broker', |
| 62 | + is_flag=True,) |
| 63 | + |
54 | 64 | def main(base_url, pact_url, pact_urls, states_url, states_setup_url, username, |
55 | | - password, timeout): |
| 65 | + password, timeout, provider_app_version, publish_verification_results): |
56 | 66 | """ |
57 | 67 | Verify one or more contracts against a provider service. |
58 | 68 |
|
@@ -94,10 +104,19 @@ def main(base_url, pact_url, pact_urls, states_url, states_setup_url, username, |
94 | 104 | '--broker-username': username, |
95 | 105 | '--broker-password': password |
96 | 106 | } |
97 | | - |
| 107 | + |
98 | 108 | command = [VERIFIER_PATH] + [ |
99 | 109 | '{}={}'.format(k, v) for k, v in options.items() if v] |
100 | | - |
| 110 | + |
| 111 | + if publish_verification_results: |
| 112 | + if not provider_app_version: |
| 113 | + click.echo( |
| 114 | + error |
| 115 | + + 'Provider application version is required ' |
| 116 | + + 'to publish verification results to broker' |
| 117 | + ) |
| 118 | + raise click.Abort() |
| 119 | + command.extend(["--provider-app-version", provider_app_version, "--publish-verification-results"]) |
101 | 120 | p = subprocess.Popen(command) |
102 | 121 | p.communicate(timeout=timeout) |
103 | 122 | sys.exit(p.returncode) |
|
0 commit comments