diff --git a/InfoLogger/README.md b/InfoLogger/README.md index 15d18d1f0..676e37a56 100644 --- a/InfoLogger/README.md +++ b/InfoLogger/README.md @@ -19,7 +19,7 @@ - [Live mode against synthetic logs (thoroughly test Live mode)](#live-mode-against-synthetic-logs-thoroughly-test-live-mode) - [Query against a local DB](#query-against-a-local-db) - [Testing](#testing) - - [Integration tests (now run elsewhere)](#integration-tests-now-run-elsewhere) + - [Integration tests (live elsewhere)](#integration-tests-live-elsewhere) - [CI](#ci) - [infologger.yml](#infologgeryml) - [release.yml](#releaseyml) @@ -160,11 +160,11 @@ Requires [Docker Desktop](https://www.docker.com/products/docker-desktop/). - Add or update the matching test when fixing a bug. - `npm run eslint` - config in [eslint.config.js](eslint.config.js). Lint failures block CI. -### Integration tests (now run elsewhere) +### Integration tests (live elsewhere) ILG integration tests live in the **system-configuration** repo and run in its pipeline against a pipeline ILG. They are **not** executed by this repo's CI. To run them locally, clone system-configuration and run `npx mocha ilg-main.js`. -> ⚠️ Files under [test/integration/](test/integration) here are a historical FLP-Suite copy, unmaintained for years. If you change behaviour covered by integration tests, update the system-configuration suite during the next ILG release. +> ⚠️ If you change behaviour covered by integration tests, update the system-configuration suite during the next ILG release. ## CI diff --git a/InfoLogger/package.json b/InfoLogger/package.json index 3f4625cc5..b9c3d0933 100644 --- a/InfoLogger/package.json +++ b/InfoLogger/package.json @@ -25,8 +25,7 @@ "eslint": "./node_modules/.bin/eslint --config eslint.config.js lib/ public/", "mocha": "mocha --exit $(find test -name 'mocha-*.js')", "coverage": "npm run eslint && nyc npm run mocha", - "coverage-local": "nyc --reporter=lcov npm run mocha", - "integration-query-test": "mocha --exit --bail ./test/integration/ilg-query-tests.js -R min" + "coverage-local": "nyc --reporter=lcov npm run mocha" }, "main": "index.js", "dependencies": { diff --git a/InfoLogger/test/integration/config-provider.js b/InfoLogger/test/integration/config-provider.js deleted file mode 100644 index 94c73b5e8..000000000 --- a/InfoLogger/test/integration/config-provider.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @license - * Copyright 2019-2020 CERN and copyright holders of ALICE O2. - * See http://alice-o2.web.cern.ch/copyright for details of the copyright holders. - * All rights not expressly granted are reserved. - * - * This software is distributed under the terms of the GNU General Public - * License v3 (GPL Version 3), copied verbatim in the file "COPYING". - * - * In applying this license CERN does not waive the privileges and immunities - * granted to it by virtue of its status as an Intergovernmental Organization - * or submit itself to any jurisdiction. -*/ - -/* eslint-disable no-console */ -/* eslint-disable max-len */ - -let testConfig; -try { - testConfig = require('./test-config'); -} catch (error) { - console.warn('`test-config.js` file could not be found. Will use default values.'); -} - -const url = (testConfig && testConfig.hostname && testConfig.port) ? `http://${testConfig.hostname}:${testConfig.port}/` : 'http://localhost:8080/'; -const timeout = (testConfig && testConfig.timeout) ? testConfig.timeout : 200000; -const facility = (testConfig && testConfig.facility) ? testConfig.facility : 'readout'; -const timestamp = (testConfig && testConfig.timestamp) ? testConfig.timestamp : '-2h'; -const queryTime = (testConfig && testConfig.queryTime) ? testConfig.queryTime : 4000; - -module.exports = {url, timeout, facility, timestamp, queryTime}; diff --git a/InfoLogger/test/integration/ilg-query-tests.js b/InfoLogger/test/integration/ilg-query-tests.js deleted file mode 100644 index 408ddf422..000000000 --- a/InfoLogger/test/integration/ilg-query-tests.js +++ /dev/null @@ -1,120 +0,0 @@ -/** - * @license - * Copyright 2019-2020 CERN and copyright holders of ALICE O2. - * See http://alice-o2.web.cern.ch/copyright for details of the copyright holders. - * All rights not expressly granted are reserved. - * - * This software is distributed under the terms of the GNU General Public - * License v3 (GPL Version 3), copied verbatim in the file "COPYING". - * - * In applying this license CERN does not waive the privileges and immunities - * granted to it by virtue of its status as an Intergovernmental Organization - * or submit itself to any jurisdiction. - */ - -/* eslint-disable @stylistic/js/max-len */ - -const puppeteer = require('puppeteer'); -const assert = require('assert'); -const config = require('./config-provider'); - -let page = undefined; -const { url } = config; -const { facility } = config; -const { timestamp } = config; - -describe('InfoLogger - FLP CI Suite Tests ', function () { - let browser = undefined; - this.timeout(config.timeout); - this.slow(3000); - - before(async () => { - // Start browser to test UI - browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'], headless: 'new' }); - page = await browser.newPage(); - - exports.page = page; - }); - - it('should load first page "/"', async () => { - // try many times until backend server is ready - for (let i = 0; i < 10; i++) { - try { - await page.goto(url, { waitUntil: 'networkidle0' }); - break; // connection ok, this test passed - } catch (e) { - if (e.message.includes('net::ERR_CONNECTION_REFUSED')) { - await new Promise((done) => setTimeout(done, 500)); - continue; // try again - } - throw e; - } - } - }); - - it('should have successfully redirected to default page "/?q={"severity":{"in":"I W E F"}}"', async () => { - const location = await page.evaluate(() => window.location); - assert.strictEqual( - location.search, - '?q={%22severity%22:{%22in%22:%22I%20W%20E%20F%22}}', - 'Could not load home page of ILG GUI', - ); - }); - - it(`should successfully type criteria based on "facility" matching ${facility}`, async () => { - const facilityCriteria = await page.evaluate((facility) => { - window.model.log.filter.resetCriteria(); - window.model.log.filter.setCriteria('facility', 'match', facility); - return window.model.log.filter.criterias.facility; - }, facility); - - assert.deepStrictEqual( - facilityCriteria, - { $exclude: null, $match: facility, exclude: '', match: facility }, - 'Criteria for "facility" could not be filled successfully in the GUI', - ); - }); - - it(`should successfully set criteria based on "time" matching ${timestamp}`, async () => { - const timestampCriteria = await page.evaluate((timestamp) => { - window.model.log.filter.setCriteria('timestamp', 'since', timestamp); - return window.model.log.filter.criterias.timestamp; - }, timestamp); - assert.deepStrictEqual( - timestampCriteria.since, - timestamp, - 'Criteria for "timestamp" could not be filled successfully in the GUI', - ); - }); - - it('should successfully click on Query button and retrieve results', async () => { - await page.evaluate(() => document.querySelector('body > div:nth-child(2) > div > header > div > div:nth-child(2) > button').click()); - await page.waitForFunction(`window.model.log.queryResult !== 'Loading'`, { timeout: 1000 }); - const result = await page.evaluate(() => { - const queryAsRemoteData = window.model.log.queryResult; - return { kind: queryAsRemoteData.kind, payload: queryAsRemoteData.payload }; - }); - assert.strictEqual(result.kind, 'Success', `Query action failed due to ${result.payload}`); - }); - - it('should have successfully received filtered data', async () => { - const { kind, payload } = await page.evaluate(() => { - const queryAsRemoteData = window.model.log.queryResult; - return { - kind: queryAsRemoteData.kind, - payload: queryAsRemoteData.payload, - }; - }); - assert.ok(kind === 'Success', `Query action failed due to ${payload}`); - assert.ok(payload?.rows?.length > 0, 'Queried data is empty and it should not be'); - - const isDataFiltered = payload.rows - .map((element) => element.facility) - .every((elementFacility) => elementFacility === facility); - assert.ok(isDataFiltered, `Data contains other facilities than ${facility}`); - }); - - after(async () => { - await browser.close(); - }); -});