Skip to content

Commit 858531c

Browse files
committed
chore: update default port 1234 to 8888 for macos arm64
1 parent 39073d8 commit 858531c

13 files changed

+58
-58
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ Use the [pact][pact] gem if you would like the full Pact DSL, mock service and v
3131
Otherwise:
3232

3333
$ gem install pact-mock_service
34-
$ pact-mock-service --consumer Foo --provider Bar --port 1234
34+
$ pact-mock-service --consumer Foo --provider Bar --port 8888
3535

3636
Or add `gem "pact-mock_service"` to your Gemfile then run:
3737

3838
$ bundle install
39-
$ bundle exec pact-mock-service --consumer Foo --provider Bar --port 1234
39+
$ bundle exec pact-mock-service --consumer Foo --provider Bar --port 8888
4040

4141
Run `pact-mock-service help` for command line options.
4242

@@ -84,11 +84,11 @@ You can find more documentation for the mock service in the repository [wiki][wi
8484

8585
If you need to use the mock service with HTTPS, you can use the built-in SSL mode which relies on and generates a self-signed certificate.
8686

87-
$ pact-mock-service --port 1234 --ssl
87+
$ pact-mock-service --port 8888 --ssl
8888

8989
If you need to provide your own certificate and key, use the following syntax.
9090

91-
$ pact-mock-service --port 1234 --ssl --sslcert PATH_TO_CERT --sslkey PATH_TO_KEY
91+
$ pact-mock-service --port 8888 --ssl --sslcert PATH_TO_CERT --sslkey PATH_TO_KEY
9292

9393
### With CORS
9494

lib/pact/mock_service/cli.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def control
5454
desc 'start', "Start a mock service. If the consumer, provider and pact-dir options are provided, the pact will be written automatically on shutdown (INT)."
5555
method_option :consumer, desc: "Consumer name"
5656
method_option :provider, desc: "Provider name"
57-
method_option :port, aliases: "-p", default: '1234', desc: "Port on which to run the service"
57+
method_option :port, aliases: "-p", default: '8888', desc: "Port on which to run the service"
5858
method_option :host, aliases: "-h", desc: "Host on which to bind the service", default: 'localhost'
5959
method_option :pact_dir, aliases: "-d", desc: "Directory to which the pacts will be written"
6060
method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
@@ -76,7 +76,7 @@ def start
7676
end
7777

7878
desc 'stop', "Stop a Pact mock service"
79-
method_option :port, aliases: "-p", desc: "Port of the service to stop", default: '1234', required: true
79+
method_option :port, aliases: "-p", desc: "Port of the service to stop", default: '8888', required: true
8080
method_option :pid_dir, desc: "PID dir, defaults to tmp/pids", default: "tmp/pids"
8181

8282
def stop
@@ -87,7 +87,7 @@ def stop
8787
desc 'restart', "Start or restart a mock service. If the consumer, provider and pact-dir options are provided, the pact will be written automatically on shutdown (INT)."
8888
method_option :consumer, desc: "Consumer name"
8989
method_option :provider, desc: "Provider name"
90-
method_option :port, aliases: "-p", default: '1234', desc: "Port on which to run the service"
90+
method_option :port, aliases: "-p", default: '8888', desc: "Port on which to run the service"
9191
method_option :host, aliases: "-h", desc: "Host on which to bind the service", default: 'localhost'
9292
method_option :pact_dir, aliases: "-d", desc: "Directory to which the pacts will be written"
9393
method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
@@ -108,7 +108,7 @@ def restart
108108
end
109109

110110
desc 'control-start', "Start a Pact mock service control server."
111-
method_option :port, aliases: "-p", desc: "Port on which to run the service", default: '1234'
111+
method_option :port, aliases: "-p", desc: "Port on which to run the service", default: '8888'
112112
method_option :host, aliases: "-h", desc: "Host on which to bind the service", default: 'localhost'
113113
method_option :log_dir, aliases: "-l", desc: "File to which to log output", default: "log"
114114
method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
@@ -129,7 +129,7 @@ def control_start
129129
end
130130

131131
desc 'control-stop', "Stop a Pact mock service control server."
132-
method_option :port, aliases: "-p", desc: "Port of control server to stop", default: "1234"
132+
method_option :port, aliases: "-p", desc: "Port of control server to stop", default: "8888"
133133
method_option :pid_dir, desc: "PID dir, defaults to tmp/pids", default: "tmp/pids"
134134

135135
def control_stop
@@ -138,7 +138,7 @@ def control_stop
138138
end
139139

140140
desc 'control-restart', "Start a Pact mock service control server."
141-
method_option :port, aliases: "-p", desc: "Port on which to run the service", default: '1234'
141+
method_option :port, aliases: "-p", desc: "Port on which to run the service", default: '8888'
142142
method_option :host, aliases: "-h", desc: "Host on which to bind the service", default: 'localhost'
143143
method_option :log_dir, aliases: "-l", desc: "File to which to log output", default: "log"
144144
method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"

packaging/RELEASE_NOTES.md.template

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ To install and run on OSX:
66
curl -LO https://github.com/bethesque/pact-mock_service/releases/download/<TAG_NAME>/pact-mock-service-<PACKAGE_VERSION>-osx.tar.gz
77
tar xzf pact-mock-service-<PACKAGE_VERSION>-osx.tar.gz
88
cd pact-mock-service-<PACKAGE_VERSION>-osx/bin
9-
./pact-mock-service -p 1234
9+
./pact-mock-service -p 8888
1010
```
1111

1212
To install and run on Linux 64 bit:
@@ -15,7 +15,7 @@ To install and run on Linux 64 bit:
1515
curl -LO https://github.com/bethesque/pact-mock_service/releases/download/<TAG_NAME>/pact-mock-service-<PACKAGE_VERSION>-linux-x86_64.tar.gz
1616
tar xzf pact-mock-service-<PACKAGE_VERSION>-linux-x86_64.tar.gz
1717
cd pact-mock-service-<PACKAGE_VERSION>-linux-x86_64/bin
18-
./pact-mock-service -p 1234
18+
./pact-mock-service -p 8888
1919
```
2020

2121
To install and run on Linux 32 bit:
@@ -24,13 +24,13 @@ To install and run on Linux 32 bit:
2424
curl -LO https://github.com/bethesque/pact-mock_service/releases/download/<TAG_NAME>/pact-mock-service-<PACKAGE_VERSION>-linux-x86.tar.gz
2525
tar xzf pact-mock-service-<PACKAGE_VERSION>-linux-x86.tar.gz
2626
cd pact-mock-service-<PACKAGE_VERSION>-linux-x86/bin
27-
./pact-mock-service -p 1234
27+
./pact-mock-service -p 8888
2828
```
2929

3030
To install and run on Windows:
3131

3232
Download package, unzip, cd to pact-mock-service-<PACKAGE_VERSION>-win32 and then run:
3333

3434
```
35-
$ .\bin\pact-mock-service.bat -p 1234
35+
$ .\bin\pact-mock-service.bat -p 8888
3636
```

script/example.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# BEFORE SUITE start mock service
44
# invoked by the pact framework
55
bundle exec bin/pact-mock-service service \
6-
--port 1234 \
6+
--port 8888 \
77
--consumer Foo \
88
--provider Bar \
99
--pact-specification-version 2 \
@@ -14,37 +14,37 @@ pid=$!
1414

1515
# BEFORE SUITE wait for mock service to start up
1616
# invoked by the pact framework
17-
while [ "200" -ne "$(curl -H "X-Pact-Mock-Service: true" -s -o /dev/null -w "%{http_code}" localhost:1234)" ]; do sleep 0.5; done
17+
while [ "200" -ne "$(curl -H "X-Pact-Mock-Service: true" -s -o /dev/null -w "%{http_code}" localhost:8888)" ]; do sleep 0.5; done
1818

1919
# uncomment this line to see the curl commands interleaved with the responses
2020
# set -x
2121

2222
# BEFORE EACH TEST clear interactions from previous test
2323
# invoked by the pact framework
24-
curl -X DELETE -H "X-Pact-Mock-Service: true" localhost:1234/interactions
24+
curl -X DELETE -H "X-Pact-Mock-Service: true" localhost:8888/interactions
2525

2626
# BEFORE A TEST set up interaction(s) just for that test
2727
# The contents of this would be written by the developer in the provided pact DSL for
2828
# your language eg. mockService.given(...).uponReceiving(...). ...
2929
# This can be called mulitple times. Alternatively PUT could be used
3030
# with a body of `{interactions: [...]}` which would negate the need to call DELETE.
31-
curl -X POST -H "X-Pact-Mock-Service: true" -d@script/consumer-interaction.json localhost:1234/interactions
31+
curl -X POST -H "X-Pact-Mock-Service: true" -d@script/consumer-interaction.json localhost:8888/interactions
3232

3333
# IN A TEST execute interaction(s)
3434
# this would be done by the consumer code under test
35-
curl localhost:1234/foo
35+
curl localhost:8888/foo
3636
echo ''
3737

3838
# AFTER EACH TEST verify interaction(s) took place
3939
# This would be done explicitly by the developer or automatically by the framework,
4040
# depending on the language
41-
curl -H "X-Pact-Mock-Service: true" localhost:1234/interactions/verification
41+
curl -H "X-Pact-Mock-Service: true" localhost:8888/interactions/verification
4242

4343
# AFTER SUITE
4444
# write pact
4545
# this would be invoked explictly by the developer or automatically framework,
4646
# depending on the language
47-
curl -X POST -H "X-Pact-Mock-Service: true" -H "Content-Length: 0" localhost:1234/pact
47+
curl -X POST -H "X-Pact-Mock-Service: true" -H "Content-Length: 0" localhost:8888/pact
4848

4949
# AFTER SUITE stop mock service
5050
# this would be invoked by the test framework

script/stub_example.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
# BEFORE SUITE start mock service
44
# invoked by the pact framework
55
bundle exec pact-stub-service script/foo-bar.json \
6-
--port 1234 \
6+
--port 8888 \
77
--log ./tmp/bar_stub_service.log &
88
pid=$!
99

1010
# BEFORE SUITE wait for mock service to start up
1111
# invoked by the pact framework
12-
while [ "200" -ne "$(curl -H "X-Pact-Mock-Service: true" -s -o /dev/null -w "%{http_code}" localhost:1234)" ]; do sleep 0.5; done
12+
while [ "200" -ne "$(curl -H "X-Pact-Mock-Service: true" -s -o /dev/null -w "%{http_code}" localhost:8888)" ]; do sleep 0.5; done
1313

1414
# IN A TEST execute interaction(s)
1515
# this would be done by the consumer code under test
16-
curl localhost:1234/foo
16+
curl localhost:8888/foo
1717
echo ''
1818

1919

spec/features/administration_endpoints_cors_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@
108108

109109
context "when the Origin header is set" do
110110
it "sets the Access-Control-Allow-Origin header to be the Origin" do
111-
options '/pact', nil, { 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'X-Pact-Mock-Service, Content-Type', 'HTTP_ORIGIN' => 'http://localhost:1234' }
112-
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:1234'
111+
options '/pact', nil, { 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'X-Pact-Mock-Service, Content-Type', 'HTTP_ORIGIN' => 'http://localhost:8888' }
112+
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:8888'
113113
end
114114
end
115115
end

spec/features/mock_interactions_with_cors_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,21 @@
5656
expect(last_response.status).to be 200
5757

5858
# OPTIONS request from the browser for the request under test
59-
options '/alligators/new', nil, { 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'accept', 'HTTP_ORIGIN' => 'http://localhost:1234' }
59+
options '/alligators/new', nil, { 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'accept', 'HTTP_ORIGIN' => 'http://localhost:8888' }
6060

6161
# Ensure it allows the browser to actually make the request
6262
expect(last_response.status).to eq 200
63-
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:1234'
63+
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:8888'
6464
expect(last_response.headers['Access-Control-Allow-Credentials']).to eq 'true'
6565
expect(last_response.headers['Access-Control-Allow-Headers']).to include 'accept'
6666
expect(last_response.headers['Access-Control-Allow-Methods']).to include "DELETE, POST, GET, HEAD, PUT, TRACE, CONNECT"
6767

6868
# Make the request
69-
post "/alligators/new", actual_request, { 'HTTP_ACCEPT' => 'application/json', 'HTTP_ORIGIN' => 'http://localhost:1234' }
69+
post "/alligators/new", actual_request, { 'HTTP_ACCEPT' => 'application/json', 'HTTP_ORIGIN' => 'http://localhost:8888' }
7070

7171
# Ensure that the response we get back was the one we expected
7272
# and includes the CORS header
73-
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:1234'
73+
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:8888'
7474
expect(last_response.headers['Content-Type']).to eq 'application/json'
7575
expect(JSON.parse(last_response.body)).to eq([{ 'name' => 'Mary' }])
7676
end

spec/integration/cli_cors_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
before :all do
1010
clear_dirs
11-
@pid = start_server 1234, '--cors'
11+
@pid = start_server 8888, '--cors'
1212
end
1313

1414
it "responds to an OPTIONS request for a non administration request" do
15-
response = make_options_request 1234
15+
response = make_options_request 8888
1616
expect(response.status).to eq 200
1717
expect(response.headers['Access-Control-Allow-Headers']).to_not be nil
1818
end

spec/integration/cli_spec.rb

+15-15
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,51 @@
77

88
before :all do
99
clear_dirs
10-
@pid = start_server 1234, "--pact-specification-version 3.0.0"
10+
@pid = start_server 8888, "--pact-specification-version 3.0.0"
1111
end
1212

1313
it "starts up and responds with mocked responses" do
14-
response = setup_interaction 1234
14+
response = setup_interaction 8888
1515
expect(response.status).to eq 200
1616

17-
response = invoke_expected_request 1234
17+
response = invoke_expected_request 8888
1818
puts response.body if response.status != 200
1919
expect(response.status).to eq 200
2020
expect(response.body).to eq 'Hello world'
2121

22-
write_pact 1234
22+
write_pact 8888
2323
expect(response.status).to eq 200
2424
end
2525

2626
it "respects headers with underscores" do
27-
setup_interaction_with_underscored_header 1234
28-
response = invoke_request_with_underscored_header 1234
27+
setup_interaction_with_underscored_header 8888
28+
response = invoke_request_with_underscored_header 8888
2929
puts response.body unless response.status == 200
3030
expect(response.status).to eq 200
3131
end
3232

3333
it "sets the X-Pact-Mock-Service-Location header" do
34-
response = setup_interaction 1234
35-
expect(response.headers['X-Pact-Mock-Service-Location']).to eq 'http://0.0.0.0:1234'
34+
response = setup_interaction 8888
35+
expect(response.headers['X-Pact-Mock-Service-Location']).to eq 'http://0.0.0.0:8888'
3636
end
3737

3838
it "writes logs to the specified log file" do
3939
expect(File.exist?('tmp/integration.log')).to be true
4040
end
4141

4242
it "writes the pact to the specified directory" do
43-
clear_interactions 1234
44-
setup_interaction 1234
45-
invoke_expected_request 1234
43+
clear_interactions 8888
44+
setup_interaction 8888
45+
invoke_expected_request 8888
4646
expect(File.exist?('tmp/pacts/consumer-provider.json')).to be true
4747
end
4848

4949
it "sets the pact specification version" do
50-
clear_interactions 1234
51-
setup_interaction 1234
52-
invoke_expected_request 1234
50+
clear_interactions 8888
51+
setup_interaction 8888
52+
invoke_expected_request 8888
5353

54-
write_pact 1234
54+
write_pact 8888
5555
expect(File.read("tmp/pacts/consumer-provider.json")).to include "3.0.0"
5656
end
5757

spec/integration/control_server_cli_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ def mock_service_headers
2222

2323
before :all do
2424
clear_dirs
25-
@pid = start_control 1234, "--pact-specification-version 3"
25+
@pid = start_control 8888, "--pact-specification-version 3"
2626
end
2727

2828
it "starts up and responds with mocked responses" do
29-
response = setup_interaction 1234
29+
response = setup_interaction 8888
3030
puts response.body unless response.status == 200
3131
expect(response.status).to eq 200
3232
mock_service_port = URI(response.headers['X-Pact-Mock-Service-Location']).port
33-
expect(mock_service_port).to_not eq 1234
33+
expect(mock_service_port).to_not eq 8888
3434

3535
response = invoke_expected_request mock_service_port
3636
expect(response.status).to eq 200

spec/integration/control_server_with_cors_cli_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
before :all do
99
clear_dirs
10-
@pid = start_control 1234, '--cors'
10+
@pid = start_control 8888, '--cors'
1111
end
1212

1313
it "responds to an OPTIONS request for a non administration request" do
14-
response = setup_interaction 1234
14+
response = setup_interaction 8888
1515
expect(response.status).to eq 200
1616
mock_service_port = URI(response.headers['X-Pact-Mock-Service-Location']).port
1717

spec/integration/control_server_with_ssl_cli_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
before :all do
99
clear_dirs
10-
@pid = start_control 1234, '--ssl'
10+
@pid = start_control 8888, '--ssl'
1111
end
1212

1313
it "sets the X-Pact-Mock-Service-Location with https" do
14-
response = setup_interaction 1234
14+
response = setup_interaction 8888
1515
expect(response.headers['X-Pact-Mock-Service-Location']).to start_with 'https://localhost:'
1616
end
1717

1818
it "responds to an OPTIONS request for a non administration request" do
19-
response = setup_interaction 1234
19+
response = setup_interaction 8888
2020
expect(response.status).to eq 200
2121
mock_service_port = URI(response.headers['X-Pact-Mock-Service-Location']).port
2222
response = connect_via_ssl mock_service_port

spec/lib/pact/mock_service/app_manager_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module Pact::MockService
1717
let(:options) { { pact_specification_version: '3' } }
1818

1919
context "for http://localhost" do
20-
let(:url) { 'http://localhost:1234'}
20+
let(:url) { 'http://localhost:8888'}
2121

2222
it "starts a mock service at the given port on localhost" do
2323
expect_any_instance_of(AppRegistration).to receive(:spawn)
@@ -27,7 +27,7 @@ module Pact::MockService
2727

2828
it "registers the mock service as running on the given port" do
2929
AppManager.instance.register_mock_service_for name, url, options
30-
expect(AppManager.instance.app_registered_on?(1234)).to eq true
30+
expect(AppManager.instance.app_registered_on?(8888)).to eq true
3131
end
3232

3333
it "reports the metric for pact mock service started" do
@@ -50,7 +50,7 @@ module Pact::MockService
5050
end
5151

5252
context "for https://" do
53-
let(:url) { 'https://localhost:1234'}
53+
let(:url) { 'https://localhost:8888'}
5454

5555
it "should throw an unsupported error" do
5656
expect { AppManager.instance.register_mock_service_for name, url, options }.to raise_error "Currently only http is supported"

0 commit comments

Comments
 (0)