-
Notifications
You must be signed in to change notification settings - Fork 28
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
Start Keploy server from Typescript-SDK #62
base: main
Are you sure you want to change the base?
Conversation
Hi @frey0-0, we should start the Keploy server from Keploy class constructor in src/keploy.ts because middleware is called on API call only. But we should check for Keploy binary during user API server setup. |
Yes that makes sense @re-Tick cause it may be possible the binary is not even present. I will look into this and mention if I have any issues here only. Thanks for the review 😄 |
@re-Tick I have made the changes now we check if the |
Hi @frey0-0, I have tried these changes in my local but the keploy binary do not run from the spawn method call. |
the spawn method call will run the binary as long as the node server is running and it will be terminated if the node server is stopped because the parent process has stopped. Please have a look at this video below. This is on my system which has the keploy binary installed This is a system which doesn't have the keploy binary The keploy server stops if we stop the node server and can be started from the command again |
I have found an interesting issue due to which Keploy binary is trying to run on the So, we can solve this by changing the env variable name in keploy to "KPORT" You can repklicate this by: |
Oh yes! I faced the same error and we should change the name of the Keploy Port. Should I add an issue and then raise a PR for this or directly raise a PR for this describing the issue for the variable name change? |
I have created an issue and also linked a PR for it. @re-Tick Please review it :) and are there any more changes that need to be done on this PR? |
src/keploy.ts
Outdated
} else { | ||
exec("lsof -i:6789", (error, stdout, stderr) => { | ||
if (!stdout) { | ||
spawn("keploy"); |
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.
Here, run the Keploy binary with KEPLOY_PORT=6789
env 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.
So I should use the command export KEPLOY_PORT=6789
before spawning the keploy binary right?
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.
Yes, this export cmd can be run with keploy using &&
in the exec method
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 have done the changes please have a look ✨
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.
LGTM. Please rebase your commit messages for the github action to pass
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 have made the changes to commit messages. I didn't know there was a specific way to write the commit messages. Thank you for being so patient 😅
4073339
to
5dcf9a5
Compare
Signed-off-by: Tanmay Bajaj <[email protected]>
Signed-off-by: Tanmay Bajaj <[email protected]>
Signed-off-by: Tanmay Bajaj <[email protected]>
* fix: stores correct http response for unique test-ids Signed-off-by: re-Tick <[email protected]> * feat(mongoose): adds hooks for mocking/stubbing mongoose methods Signed-off-by: re-Tick <[email protected]> * docs: updates the docs for mongoose and refactors Signed-off-by: re-Tick <[email protected]> * docs: refactors readme for e2e and mocks-lib docs Signed-off-by: re-Tick <[email protected]> * docs: adds require stmt in docs code snippet Signed-off-by: re-Tick <[email protected]> --------- Signed-off-by: re-Tick <[email protected]> Signed-off-by: Tanmay Bajaj <[email protected]>
Signed-off-by: Tanmay Bajaj <[email protected]>
Signed-off-by: re-Tick <[email protected]> Signed-off-by: Tanmay Bajaj <[email protected]>
the executionContext was getting undefined for mocking dependency call outputs Signed-off-by: re-Tick <[email protected]> Signed-off-by: Tanmay Bajaj <[email protected]>
Signed-off-by: Tanmay Bajaj <[email protected]>
946d18a
to
8e4c07e
Compare
LGTM. Please add the link in GSOC task list |
Fixes #352
If the keploy mode is record and test then it will check if keploy is running on port 6789 and if it isn't then it will start an asynchronously process to start the keploy server and the server won't keeping running, it will stop the server as soon as the main app server stops