Reducing the noise on websocket testing

This commit is contained in:
Joakim Erdfelt 2014-05-05 12:09:48 -07:00
parent c0e0f9bb83
commit 8e957b5a23
6 changed files with 16 additions and 11 deletions

View File

@ -223,7 +223,6 @@ public class EchoTest
WebAppContext webapp = server.createWebAppContext();
server.deployWebapp(webapp);
server.dump();
}
@BeforeClass

View File

@ -60,7 +60,6 @@ public class PingPongTest
WebAppContext webapp = server.createWebAppContext();
server.deployWebapp(webapp);
server.dump();
}
@BeforeClass

View File

@ -41,6 +41,7 @@ import org.eclipse.jetty.toolchain.test.TestTracker;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.util.thread.Scheduler;
import org.eclipse.jetty.websocket.api.ProtocolException;
import org.eclipse.jetty.websocket.api.Session;
@ -50,6 +51,7 @@ import org.eclipse.jetty.websocket.client.io.ConnectionManager;
import org.eclipse.jetty.websocket.client.io.WebSocketClientSelectorManager;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.OpCode;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.WebSocketSession;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
@ -458,13 +460,16 @@ public class ClientCloseTest
bad.putShort((short)StatusCode.NORMAL);
bad.put(msg);
BufferUtil.flipToFlush(bad,0);
serverConn.write(bad);
try (StacklessLogging quiet = new StacklessLogging(Parser.class))
{
serverConn.write(bad);
// client should have noticed the error
clientSocket.assertReceivedError(ProtocolException.class,containsString("Invalid control frame"));
// client should have noticed the error
clientSocket.assertReceivedError(ProtocolException.class,containsString("Invalid control frame"));
// client parse invalid frame, notifies server of close (protocol error)
confirmServerReceivedCloseFrame(serverConn,StatusCode.PROTOCOL,allOf(containsString("Invalid control frame"),containsString("length")));
// client parse invalid frame, notifies server of close (protocol error)
confirmServerReceivedCloseFrame(serverConn,StatusCode.PROTOCOL,allOf(containsString("Invalid control frame"),containsString("length")));
}
// server disconnects
serverConn.disconnect();

View File

@ -581,7 +581,7 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
}
catch (CloseException e)
{
LOG.warn(e);
LOG.debug(e);
close(e.getStatusCode(),e.getMessage());
return -1;
}

View File

@ -54,7 +54,8 @@ public class ChromeTest
@Test
public void testUpgradeWithWebkitDeflateExtension() throws Exception
{
Assume.assumeTrue("Server has x-webkit-deflate-frame registered",server.getWebSocketServletFactory().getExtensionFactory().isAvailable("x-webkit-deflate-frame"));
Assume.assumeTrue("Server has x-webkit-deflate-frame registered",
server.getWebSocketServletFactory().getExtensionFactory().isAvailable("x-webkit-deflate-frame"));
BlockheadClient client = new BlockheadClient(server.getServerUri());
try

View File

@ -4,7 +4,7 @@ org.eclipse.jetty.LEVEL=WARN
# org.eclipse.jetty.io.WriteFlusher.LEVEL=DEBUG
# org.eclipse.jetty.websocket.LEVEL=DEBUG
# org.eclipse.jetty.websocket.LEVEL=INFO
org.eclipse.jetty.websocket.common.io.LEVEL=DEBUG
# org.eclipse.jetty.websocket.common.io.LEVEL=DEBUG
# org.eclipse.jetty.websocket.server.ab.LEVEL=DEBUG
# org.eclipse.jetty.websocket.common.Parser.LEVEL=DEBUG
# org.eclipse.jetty.websocket.common.Generator.LEVEL=DEBUG
@ -19,5 +19,6 @@ org.eclipse.jetty.websocket.server.browser.LEVEL=DEBUG
### Disabling intentional error out of RFCSocket
org.eclipse.jetty.websocket.server.helper.RFCSocket.LEVEL=OFF
### Hiding Stack Traces from ABSocket
### Hiding Stack Traces from various test cases
org.eclipse.jetty.websocket.server.ab.ABSocket.STACKS=OFF
org.eclipse.jetty.websocket.server.WebSocketCloseTest$FastFailSocket.STACKS=OFF