Skip to content

Commit

Permalink
Tweak test server to reveal concurrency bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
aseemk committed Oct 10, 2011
1 parent 8240ff7 commit 83234e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/app.js
Expand Up @@ -11,7 +11,10 @@ app.set('view engine', 'html');
app.register('.html', require('ejs'));

app.get('/', function (req, res) {
res.render('child');
// create an artificial delay to test concurrency
setTimeout(function () {
res.render('child');
}, 1000);
});

// since this is a test server, don't listen -- just return the server.
Expand Down

3 comments on commit 83234e2

@gasi
Copy link

@gasi gasi commented on 83234e2 Oct 10, 2011

Choose a reason for hiding this comment

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

Were you able to repro it?

@aseemk
Copy link
Owner Author

@aseemk aseemk commented on 83234e2 Oct 10, 2011

Choose a reason for hiding this comment

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

Yep! This is because expresso (the test runner this uses) runs tests in parallel, so adding a delay ensured that the concurrency bug was hit.

@gasi
Copy link

@gasi gasi commented on 83234e2 Oct 10, 2011

Choose a reason for hiding this comment

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

Beautiful.

Please sign in to comment.