Zuul tests fail when using multiple sockets #620

Closed
kevin-roark opened this Issue Feb 9, 2014 · 5 comments

Comments

Projects
None yet
3 participants
Contributor

kevin-roark commented Feb 9, 2014

Currently mocha tests using zuul have to use the same global socket -- if each test uses a separate socket, only the first test passes and every other test fails, regardless of the test.

It is probably related to multiplexing and the single socket being closed. It is also probably socket.io level because engine.io browser tests use individual sockets and work fine.

Contributor

kevin-roark commented Feb 9, 2014

This fails:

  it('should connect to localhost', function(done) {
    var socket = io();
    socket.emit('hi');
    socket.on('hi', function(data){
      socket.close();
      done();
    });
  });

 it('should connect to localhost again', function(done) {
    var socket = io();
    socket.emit('hi');
    socket.on('hi', function(data){
      socket.close();
      done();
    });
  });
Contributor

kevin-roark commented Feb 9, 2014

But this passes:

var socket = io();
it('should connect to localhost', function(done) {
socket.emit('hi');
socket.on('hi', function(data){
done();
});
});

it('should connect to localhost again', function(done) {
var socket = io();
socket.emit('hi');
socket.on('hi', function(data){
done();
});
});
Contributor

JulianSlzr commented Mar 6, 2014

@poohlty and I ran into this while writing tests.

The second time io() is called, the closed socket for '/' is returned. Inserting socket.open() before using it again almost works, but the original 'hi' handler is still bound, so it results in done() being called twice in the above example.

@guille: Was wondering if io()'s behavior could be to, if the socket exists but is not open, to reopen before returning it? Or is that too much of an exception?

Contributor

rase- commented May 24, 2014

@kevin-roark can this be closed?

Contributor

rase- commented Jan 12, 2015

This doesn't seem to be the case anymore.

@rase- rase- closed this Jan 12, 2015

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