Skip to content
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

Integration tests never complete #3222

Open
2 tasks done
paulsmithkc opened this issue Dec 10, 2022 · 0 comments
Open
2 tasks done

Integration tests never complete #3222

paulsmithkc opened this issue Dec 10, 2022 · 0 comments

Comments

@paulsmithkc
Copy link

  • Package Name: azure function core tools
  • Package Version: 4.0.4829
  • Operating system: MacOS 13.0.1
  • nodejs
    • version: 16.16.0
  • typescript
    • version: 4.9.4

Describe the bug
We are attempting to write some integration tests for our azure functions, however the function runtime restarts instead of exiting when the test are complete, so the process never finishes.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new function app
  2. Create at least one http trigger
  3. Write an integration test using jest which makes a http request against the trigger
  4. Install the following packages: jest, ts-jest, concurrently, wait-on
  5. Add the following scripts to package.json
"pretest": "tsc -p tsconfig.test.json",
"test": "concurrently -k -s last \"func start\" \"wait-on tcp:7071 && jest\"",
  1. Execute the following command on the terminal: npm run test
  2. Wait for process to complete.

Expected behavior
When the jest exits, concurrently should kill the azure function runtime, and terminate.

Actual behavior

  1. Jest exits successfully.
  2. Concurrently sends a kill signal to the azure function runtime.
  3. The azure function runtime restarts itself and keeps running.
  4. Integration tests never complete, because runtime is still active.

Relevant Console Output

[1] Ran all test suites.
[1] wait-on tcp:7071 && jest exited with code 0
--> Sending SIGTERM to other processes..
[0] [2022-12-08T16:06:34.042Z] Language Worker Process exited. Pid=64056.
[0] [2022-12-08T16:06:34.042Z] node exited with code 143 (0x8F). .
[0] [2022-12-08T16:06:34.280Z] Worker process started and initialized.

Proposed Fix
Add a command line argument to func start which prevents the runtime from restarting when it is killed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant