Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Commit

Permalink
[tests] Add server error handling to dhcp ws tests
Browse files Browse the repository at this point in the history
The payload is too large but it wasn't clear because server errors
were being ignored. We still need to look into why the payload is too
large and whether it's a bug or this test should extend the max payload.

The tests seem to work if you increase the payload size.

Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
  • Loading branch information
grgustaf committed Sep 5, 2017
1 parent 83ec422 commit 087938a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions tests/test-dhcp-ws-manual.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ if (board.name === "arduino_101") {
});

SocketBody(WSServer);

WSServer.on('error', function (error) {
console.log('Server socket: ' + error.name + ': ' + error.message);
});
});

netConfig.on("netdown", function() {
Expand Down Expand Up @@ -122,5 +126,9 @@ if (board.name === "arduino_101") {
});

SocketBody(WSServer);

WSServer.on('error', function (error) {
console.log('Server socket: ' + error.name + ': ' + error.message);
});
});
}
10 changes: 7 additions & 3 deletions tests/test-ws4-server-dhcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Run this test case and run ws client on linux with
// tests/tools/test-ws4-client-dhcp.js

console.log("Test web socket server APIs on IPv4 with DHCP mode...");
console.log("Test websocket server APIs on IPv4 with DHCP mode...");

var WebSocket = require("ws");
var assert = require("Assert.js");
Expand Down Expand Up @@ -32,13 +32,13 @@ netConfig.dhcp(function(address, subnet, gateway) {
});

assert(typeof WSServer === "object" && WSServer !== null,
"WSServerObject: be defined");
"WSServer object is defined");

WSServer.on("connection", function(websocket) {
assert(true, "WSServerObject: accept client connected");
assert(true, "WSServerEvent: be called as 'connection' event");

console.log("Creat web socket connection successful");
console.log("Create websocket connection successful");

var messageFlag = true;
var sendNoMaskFlag = false;
Expand Down Expand Up @@ -203,4 +203,8 @@ netConfig.dhcp(function(address, subnet, gateway) {
}
}, 3000);
});

WSServer.on('error', function (error) {
console.log('Server socket: ' + error.name + ': ' + error.message);
});
});

0 comments on commit 087938a

Please sign in to comment.