Code Monkey home page Code Monkey logo

Comments (17)

superbobry avatar superbobry commented on June 19, 2024

Confirmed, I've just ran into a similar issue with [email protected]

from expresso.

Swatinem avatar Swatinem commented on June 19, 2024

I get the following error when I have more than one assert.response test:
uncaught: Error: ECONNREFUSED, Connection refused
at Client._onConnect (net.js:548:18)
at IOWatcher.onWritable as callback

But I only run into that problem with node 0.3.6 (both expresso 0.7.0 and 0.7.2). On node 0.2.6 it runs fine with expresso 0.7.2

from expresso.

andrewjstone avatar andrewjstone commented on June 19, 2024

I'm having the same issue as well with node 0.4.0 and expresso 0.7.2.

from expresso.

mikemee avatar mikemee commented on June 19, 2024

confirmed its also seems to be a problem with expresso 0.7.2 and node 0.4.1

from expresso.

torgeir avatar torgeir commented on June 19, 2024

the same (ECONNREFUSED, Connection refused) is seen from two assert.response in the same test using the serial option with node 0.4.4 and expresso 0.7.5

from expresso.

jufo avatar jufo commented on June 19, 2024

I see this problem, using expresso 0.7.6.

I think the problem is that when you run tests with --serial, expresso closes the server after each test. When it re-opens it, it increments the port number. However it has cached the HTTP client in server.client, and it doesn't clear this cache when closing the server. Changing the code (in the issue function) at line 403 of the expresso file from

client = server.client,

to

client = http.createClient(server.__port),

seems to sort things out. (The earlier lines looking at the cached server.client and updating it if it is empty can be removed.) Alternatively the cache can be cleared when the server is closed, but I'd prefer the solution with the fewest lines of code.

One other thing I noticed when investigating this - at line 478, the code

// Callback
callback(response);
check();

allows the next test to begin before the check() call closes the server. Calling check() before calling the callback gives stronger serialization of the tests.

from expresso.

jufo avatar jufo commented on June 19, 2024

(I'm assuming there was a good reason for incrementing the port number.)

from expresso.

tj avatar tj commented on June 19, 2024

they are run in parallel so you kinda have to

from expresso.

jufo avatar jufo commented on June 19, 2024

In production the application would need to handle many concurrent requests, but that doesn't mean it needs to listen on more than one port. Is there something I'm missing about the way the test drives the application?

Anyway, did my earlier comment make sense?

from expresso.

tj avatar tj commented on June 19, 2024

you can use assert.response() with more than one server in more than one test running parallel

from expresso.

jufo avatar jufo commented on June 19, 2024

OK, I see that different servers would need different ports. I'm not convinced that you need to change the port on an existing server when you close and re-open it.

from expresso.

tj avatar tj commented on June 19, 2024

nah, but nothing about expresso is polished lol only a rewrite will solve that

from expresso.

jufo avatar jufo commented on June 19, 2024

Perhaps a bit of tidying up. I shall read it a bit more, and read some of the other open issues. I think my comment above about needing a new client when you change the server port is the answer to this particular one.

from expresso.

tj avatar tj commented on June 19, 2024

it's super messy haha I started a rewrite but i dont have it up on github

from expresso.

kcbanner avatar kcbanner commented on June 19, 2024

This seems to still be happening with node 0.4.7 and express 2.3.4

from expresso.

jufo avatar jufo commented on June 19, 2024

Looks to me as if this is fixed now, in 0.7.7.

from expresso.

mhemesath avatar mhemesath commented on June 19, 2024

This is happening for me as well, but only about 75% of the time.

  • Expres v2.4.0
  • Expresso v0.7.9

from expresso.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.