Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Zuul tests fail when using multiple sockets #620

Closed
kevin-roark opened this Issue · 5 comments

3 participants

@kevin-roark
Collaborator

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.

@kevin-roark
Collaborator

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();
    });
  });
@kevin-roark
Collaborator

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();
});
});
@j-salazar

@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?

@rase-
Owner

@kevin-roark can this be closed?

@rase-
Owner

This doesn't seem to be the case anymore.

@rase- rase- closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.