Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIDEO-3946 Stabilize network tests #1434

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ commands:
steps:
- get-code # note: network tests run inside docker - the dependencies will be fetched inside docker image.
- run:
name: Running Network Tests (environment = << pipeline.parameters.environment >>)
name: Running Network Tests (environment = prod)
command: scripts/circleci-run-tests.sh
- save-test-results
framework-tests:
Expand Down Expand Up @@ -228,6 +228,7 @@ jobs:
TEST_TYPE: "network"
BVER: "stable"
BROWSER: << parameters.browser >>
ENVIRONMENT: "prod"
TOPOLOGY: << parameters.topology >>
TEST_STABILITY: << parameters.test_stability >>
executor: machine-executor
Expand Down
7 changes: 2 additions & 5 deletions docker/dockerProxyClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let requestNumber = 0;
class DockerProxyClient {
/**
* Construct a new {@link DockerProxyClient}.
* @param {string} serverUrl - url pointing to an instance of {@link DockerProxyServer}
* @param {string} [serverUrl] - url pointing to an instance of {@link DockerProxyServer}
*/
constructor(serverUrl) {
this._serverUrl = serverUrl || DOCKER_PROXY_SERVER_URL;
Expand Down Expand Up @@ -155,12 +155,9 @@ class DockerProxyClient {
const thisRequestNumber = requestNumber++;
const logPrefix = `DockerProxyClient [${thisRequestNumber}]: `;
try {
console.log(logPrefix + 'Requesting: ', api);
const res = await fetch(this._serverUrl + api);
const text = await res.text();
const json = text ? JSON.parse(text) : {};
console.log(logPrefix + 'Done: ', api, json);
return json;
return text ? JSON.parse(text) : {};
} catch (err) {
console.error(logPrefix + 'Threw : ', err);
throw err;
Expand Down
7 changes: 1 addition & 6 deletions docker/dockerProxyServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ class DockerProxyServer {
app.get(endpoint, async ({ params }, res, next) => {
const thisRequestNumber = requestNumber++;
const logPrefix = `DockerProxyServer [${thisRequestNumber}]: `;
console.log(logPrefix + 'Executing: ', endpoint, params);
try {
const data = await this[handleRequest](params);
console.log(logPrefix + 'Done executing: ', endpoint, params);
return res.send(data);
} catch (err) {
console.error(logPrefix + 'Error executing: ', endpoint, params);
Expand All @@ -76,10 +74,7 @@ class DockerProxyServer {
});

return new Promise((resolve, reject) => {
this._server = app.listen(this._serverPort, () => {
console.log(`DockerProxyServer listening on port ${this._serverPort}!`);
resolve();
});
this._server = app.listen(this._serverPort, resolve);
this._server.once('error', reject);
});
}
Expand Down
2 changes: 0 additions & 2 deletions docker/fetchRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ let requestId = 200;
function fetchRequest(options, postData) {
const thisRequest = requestId++;
const logPrefix = `fetchRequest[${thisRequest}]: `;
console.log(logPrefix + 'Processing ', postData);
return new Promise((resolve, reject) => {
let clientRequest = http.request(options, res => {
const requestFailed = res.statusCode !== 200 && res.statusCode !== 201;
Expand All @@ -27,7 +26,6 @@ function fetchRequest(options, postData) {
if (requestFailed) {
console.warn(logPrefix + 'requestFailed2 returned:', res.statusCode, postData);
}
console.log(logPrefix + 'resolving');
resolve(parsedData);
} catch (e) {
console.error(logPrefix + 'rejecting:', e);
Expand Down
Loading