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

Fix run_plugins_spec test leaking into other tests, other flake in request_spec #4600

Merged
merged 3 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe "lib/plugins/child/run_plugins", ->
@ipc.on.withArgs("load").yields({})
runPlugins(@ipc, "plugins-file")

@ipc.send = (event, errorType, pluginsFile, stack) ->
@ipc.send = _.once (event, errorType, pluginsFile, stack) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving but why can't we use sinon to handle the mocking behavior since it's automatically torn down at the end of the test?

If that doesn't work - then we have something else still running async in the background causing the leak into another test - and likely the code needs to be refactored to properly handle this.

expect(event).to.eq("load:error")
expect(errorType).to.eq("PLUGINS_FUNCTION_ERROR")
expect(pluginsFile).to.eq("plugins-file")
Expand All @@ -96,7 +96,7 @@ describe "lib/plugins/child/run_plugins", ->
runPlugins(@ipc, "plugins-file")
@ipc.on.withArgs("load").yield()

@ipc.send = (event, errorType, pluginsFile, stack) ->
@ipc.send = _.once (event, errorType, pluginsFile, stack) ->
expect(event).to.eq("load:error")
expect(errorType).to.eq("PLUGINS_FUNCTION_ERROR")
expect(pluginsFile).to.eq("plugins-file")
Expand Down
2 changes: 2 additions & 0 deletions packages/server/test/unit/request_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ describe "lib/request", ->
opts = {
url: "http://localhost:9988/econnreset"
retryIntervals: [0, 1, 2, 3]
timeout: 250
}

stream = request.create(opts)
Expand Down Expand Up @@ -252,6 +253,7 @@ describe "lib/request", ->
opts = {
url: "http://localhost:9988/econnreset"
retryIntervals: [0, 1, 2, 3]
timeout: 250
}

request.create(opts, true)
Expand Down