Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.

Add stop command to unmock-server. #374

Merged
merged 7 commits into from
Jan 28, 2020
Merged

Add stop command to unmock-server. #374

merged 7 commits into from
Jan 28, 2020

Conversation

ksaaskil
Copy link
Contributor

@ksaaskil ksaaskil commented Jan 24, 2020

  • Add unmock-server stop command
  • Works by writing process PID to ~/.unmock/server.pid to file when unmock server is started and adding a SIGTERM handler. Stop command then reads the file and sends SIGTERM to the process.
  • Alternative would be to add an endpoint in the servers such as "/stop" but implementing that is not the easiest thing for the proxy server. Or should one add an /api/stop endpoint in the mock server and also stop the proxy server there, coupling the two?
  • Could something go wrong if the PID in server.pid points to the wrong process? This should not happen if start command gets to do its clean-up properly (defined in process.exit handler)

@codecov-io
Copy link

codecov-io commented Jan 24, 2020

Codecov Report

Merging #374 into dev will decrease coverage by 0.04%.
The diff coverage is 77.5%.

Impacted file tree graph

@@            Coverage Diff            @@
##              dev    #374      +/-   ##
=========================================
- Coverage   80.35%   80.3%   -0.05%     
=========================================
  Files          54      55       +1     
  Lines        2428    2468      +40     
  Branches      585     592       +7     
=========================================
+ Hits         1951    1982      +31     
- Misses        477     486       +9
Impacted Files Coverage Δ
packages/unmock-server/src/server.ts 66.21% <0%> (-0.91%) ⬇️
packages/unmock-server/src/pid.ts 79.48% <79.48%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e21b98...28b329a. Read the comment docs.

@ksaaskil ksaaskil marked this pull request as ready for review January 24, 2020 13:19
@ksaaskil ksaaskil merged commit c2a3d21 into dev Jan 28, 2020
@ksaaskil ksaaskil deleted the server-stop-cmd branch January 28, 2020 06:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants