Skip to content

Commit 4ad094c

Browse files
committed
Adding support for monkey patching the ruby core host
1 parent 2d8382a commit 4ad094c

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

Build/Download-Standalone-Core.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ New-Item -ItemType directory -Path $OutputPath | Out-Null
2626

2727
Import-Module -Name $7ZipSnapIn
2828

29-
$StandaloneCoreVersion = '1.33.1'
29+
$StandaloneCoreVersion = '1.43.1'
3030
$StandaloneCoreDownloadBaseUri = "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v$StandaloneCoreVersion"
3131

3232
# Download and extract the Windows core

PactNet/Core/MockProviderHostConfig.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ internal class MockProviderHostConfig : IPactCoreHostConfig
1616
public MockProviderHostConfig(int port, bool enableSsl, string consumerName, string providerName, PactConfig config, IPAddress host)
1717
{
1818
var logFile = $"{config.LogDir}{providerName.ToLowerSnakeCase()}_mock_service.log";
19-
var sslOption = enableSsl ? " --ssl" : "";
20-
var hostOption = host == IPAddress.Any ? $" --host=0.0.0.0" : "";
19+
var sslOption = enableSsl ? " --ssl" : string.Empty;
20+
var hostOption = host == IPAddress.Any ? " --host=0.0.0.0" : string.Empty;
21+
var monkeyPatchOption = !string.IsNullOrEmpty(config?.MonkeyPatchFile) ? $" --monkeypatch=\"${config.MonkeyPatchFile}\"" : string.Empty;
2122

2223
Script = "pact-mock-service";
23-
Arguments = $"-p {port} -l \"{FixPathForRuby(logFile)}\" --pact-dir \"{FixPathForRuby(config.PactDir)}\" --pact-specification-version \"{config.SpecificationVersion}\" --consumer \"{consumerName}\" --provider \"{providerName}\"{sslOption}{hostOption}";
24+
Arguments = $"-p {port} -l \"{FixPathForRuby(logFile)}\" --pact-dir \"{FixPathForRuby(config.PactDir)}\" --pact-specification-version \"{config.SpecificationVersion}\" --consumer \"{consumerName}\" --provider \"{providerName}\"{sslOption}{hostOption}{monkeyPatchOption}";
2425
WaitForExit = false;
2526
Outputters = config?.Outputters;
2627
}

PactNet/Core/PactVerifierHostConfig.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ public PactVerifierHostConfig(Uri baseUri, string pactUri, PactUriOptions pactBr
2121
$" --custom-provider-header \"{config.CustomHeader?.Key}:{config.CustomHeader?.Value}\"" :
2222
string.Empty;
2323
var verbose = config?.Verbose == true ? " --verbose true" : string.Empty;
24+
var monkeyPatchOption = !string.IsNullOrEmpty(config?.MonkeyPatchFile) ? $" --monkeypatch=\"${config.MonkeyPatchFile}\"" : string.Empty;
2425

2526
Script = "pact-provider-verifier";
26-
Arguments = $"\"{FixPathForRuby(pactUri)}\" --provider-base-url {baseUri.OriginalString}{providerStateOption}{brokerCredentials}{publishResults}{customHeader}{verbose}";
27+
Arguments = $"\"{FixPathForRuby(pactUri)}\" --provider-base-url {baseUri.OriginalString}{providerStateOption}{brokerCredentials}{publishResults}{customHeader}{verbose}{monkeyPatchOption}";
2728
WaitForExit = true;
2829
Outputters = config?.Outputters;
2930
Environment = new Dictionary<string, string>

PactNet/PactConfig.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public string LogDir
2626

2727
internal string LoggerName;
2828

29+
public string MonkeyPatchFile { get; set; }
30+
2931
public PactConfig()
3032
{
3133
PactDir = Constants.DefaultPactDir;

PactNet/PactVerifierConfig.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public class PactVerifierConfig
1515

1616
public bool Verbose { get; set; }
1717

18+
public string MonkeyPatchFile { get; set; }
19+
1820
public PactVerifierConfig()
1921
{
2022
Outputters = new List<IOutput>

0 commit comments

Comments
 (0)