Skip to content

Commit 39b182e

Browse files
authored
[OGUI-914] Users would like for default opening page to still go to trace rather than Ops (#3484)
* reverts a change so that default page still uses `trace` as default level * improves testing so that a copy is done of the DB json file used for testing. This will allow for multiple runs of testing environment without causing failures on/off of tests due to changes to the db file during the run
1 parent c372b85 commit 39b182e

4 files changed

Lines changed: 23 additions & 24 deletions

File tree

InfoLogger/public/logFilter/LogFilter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,8 @@ export default class LogFilter extends Observable {
429429
$in: ['I', 'W', 'E', 'F'],
430430
},
431431
level: {
432-
max: 1,
433-
$max: 1,
432+
max: null,
433+
$max: null,
434434
},
435435
};
436436
this.notify();

InfoLogger/test/mocha-index.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
* In applying this license CERN does not waive the privileges and immunities
1111
* granted to it by virtue of its status as an Intergovernmental Organization
1212
* or submit itself to any jurisdiction.
13-
*/
13+
*/
1414

1515
/* eslint-disable no-console */
1616
const puppeteer = require('puppeteer');
1717
const assert = require('assert');
18-
const {spawn} = require('child_process');
18+
const { spawn } = require('child_process');
1919

2020
const config = require('./test-config.js');
21-
const {createServer, closeServer} = require('./live-simulator/infoLoggerServer.js');
21+
const { createServer, closeServer } = require('./live-simulator/infoLoggerServer.js');
2222

2323
// APIs:
2424
// https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md
@@ -28,16 +28,16 @@ const {createServer, closeServer} = require('./live-simulator/infoLoggerServer.j
2828
// Network and rendering can have delays this can leads to random failures
2929
// if they are tested just after their initialization.
3030

31-
describe('InfoLogger', function() {
31+
describe('InfoLogger', function () {
3232
let browser;
3333
let page;
3434
let subprocess; // web-server runs into a subprocess
3535
let subprocessOutput = '';
3636
let ilgServer;
37-
37+
3838
this.timeout(30000);
3939
this.slow(1000);
40-
40+
4141
const baseUrl = `http://${config.http.hostname}:${config.http.port}/`;
4242

4343
before(async () => {
@@ -62,26 +62,27 @@ describe('InfoLogger', function() {
6262
ilgServer = createServer();
6363

6464
// Start web-server in background
65-
subprocess = spawn('node', ['index.js', 'test/test-config.js'], {stdio: 'pipe'});
65+
subprocess = spawn('node', ['index.js', 'test/test-config.js'], { stdio: 'pipe' });
6666
subprocess.stdout.on('data', (chunk) => subprocessOutput += chunk.toString());
6767
subprocess.stderr.on('data', (chunk) => subprocessOutput += chunk.toString());
68-
subprocess.on('error', (error) => console.error(`Server failed due to: ${error}`))
68+
subprocess.on('error', (error) => console.error(`Server failed due to: ${error}`));
6969

7070
// Start browser to test UI
71-
browser = await puppeteer.launch({headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox']});
71+
browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'] });
7272
page = await browser.newPage();
7373
await page.setViewport({ width: 1440, height: 900 }); // 15" screen equivalent
7474

7575
// Export page and configurations for the other mocha files
7676
exports.page = page;
77-
exports.helpers = {baseUrl, jwt: config.jwt};
77+
78+
exports.helpers = { baseUrl, jwt: config.jwt };
7879
});
7980

8081
it('should load first page "/"', async () => {
8182
// try many times until backend server is ready
8283
for (let i = 0; i < 10; i++) {
8384
try {
84-
await page.goto(baseUrl, {waitUntil: 'networkidle0'});
85+
await page.goto(baseUrl, { waitUntil: 'networkidle0' });
8586
break; // connection ok, this test passed
8687
} catch (e) {
8788
if (e.message.includes('net::ERR_CONNECTION_REFUSED')) {
@@ -93,12 +94,12 @@ describe('InfoLogger', function() {
9394
}
9495
});
9596

96-
it('should have redirected to default page "/?q={"severity":{"in":"I W E F"},"level":{"max":1}}"', async function() {
97-
await page.goto(baseUrl, {waitUntil: 'networkidle0'});
97+
it('should have redirected to default page "/?q={"severity":{"in":"I W E F"}}"', async () => {
98+
await page.goto(baseUrl, { waitUntil: 'networkidle0' });
9899
const location = await page.evaluate(() => window.location);
99100
const search = decodeURIComponent(location.search);
100101

101-
assert.deepStrictEqual(search, '?q={"severity":{"in":"I W E F"},"level":{"max":1}}');
102+
assert.deepStrictEqual(search, '?q={"severity":{"in":"I W E F"}}');
102103
});
103104

104105
require('./public/user-actions-mocha');
@@ -118,7 +119,5 @@ describe('InfoLogger', function() {
118119
console.log('---------------------------------------------');
119120
subprocess.kill();
120121
closeServer(ilgServer);
121-
122122
});
123123
});
124-

InfoLogger/test/public/live-mode-mocha.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('Live Mode test-suite', async () => {
2727
const location = await page.evaluate(() => window.location);
2828
const search = decodeURIComponent(location.search);
2929

30-
assert.deepStrictEqual(search, '?q={"severity":{"in":"I W E F"},"level":{"max":1}}');
30+
assert.deepStrictEqual(search, '?q={"severity":{"in":"I W E F"}}');
3131
});
3232

3333
it('should successfully enable LIVE mode', async () => {

InfoLogger/test/public/log-filter-actions-mocha.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('Filter actions test-suite', async () => {
9595
});
9696

9797
it('should redirect to default filters and show JSON parse error on malformed q in URI', async () => {
98-
const expectedDefaultParams = '?q={"severity":{"in":"I W E F"},"level":{"max":1}}';
98+
const expectedDefaultParams = '?q={"severity":{"in":"I W E F"}}';
9999

100100
const locationAndNotification = await page.evaluate(() => {
101101
const params = { q: '{"severity":{"in":"W I E F"' };
@@ -116,8 +116,8 @@ describe('Filter actions test-suite', async () => {
116116

117117
it('should update URI with new encoded "match" criteria', async () => {
118118
/* eslint-disable max-len */
119-
const decodedParams = '?q={"hostname":{"match":"\\"%ald_qdip01%"},"severity":{"in":"I W E F"},"level":{"max":1}}';
120-
const expectedParams = '?q={%22hostname%22:{%22match%22:%22%5C%22%25ald_qdip01%25%22},%22severity%22:{%22in%22:%22I%20W%20E%20F%22},%22level%22:{%22max%22:1}}';
119+
const decodedParams = '?q={"hostname":{"match":"\\"%ald_qdip01%"},"severity":{"in":"I W E F"}}';
120+
const expectedParams = '?q={%22hostname%22:{%22match%22:%22%5C%22%25ald_qdip01%25%22},%22severity%22:{%22in%22:%22I%20W%20E%20F%22}}';
121121
const searchParams = await page.evaluate(() => {
122122
window.model.log.filter.setCriteria('hostname', 'match', '"%ald_qdip01%');
123123
window.model.updateRouteOnModelChange();
@@ -130,8 +130,8 @@ describe('Filter actions test-suite', async () => {
130130

131131
it('should update URI with new encoded "exclude" criteria', async () => {
132132
/* eslint-disable max-len */
133-
const decodedParams = '?q={"hostname":{"exclude":"\\"%ald_qdip01%"},"severity":{"in":"I W E F"},"level":{"max":1}}';
134-
const expectedParams = '?q={%22hostname%22:{%22exclude%22:%22%5C%22%25ald_qdip01%25%22},%22severity%22:{%22in%22:%22I%20W%20E%20F%22},%22level%22:{%22max%22:1}}';
133+
const decodedParams = '?q={"hostname":{"exclude":"\\"%ald_qdip01%"},"severity":{"in":"I W E F"}}';
134+
const expectedParams = '?q={%22hostname%22:{%22exclude%22:%22%5C%22%25ald_qdip01%25%22},%22severity%22:{%22in%22:%22I%20W%20E%20F%22}}';
135135
const searchParams = await page.evaluate(() => {
136136
window.model.log.filter.resetCriteria();
137137
window.model.log.filter.setCriteria('hostname', 'exclude', '"%ald_qdip01%');

0 commit comments

Comments
 (0)