//
// SPDX-License-Identifier: AGPL-3.0
+import { ContainerState } from 'models/container';
+
describe('Process tests', function() {
let activeUser;
let adminUser;
describe('Logs panel', function() {
it('shows live process logs', function() {
+ cy.intercept({method: 'GET', url: '**/arvados/v1/containers/*'}, (req) => {
+ req.reply((res) => {
+ res.body.state = ContainerState.RUNNING;
+ });
+ });
+
const crName = 'test_container_request';
createContainerRequest(
activeUser,
['echo', 'hello world'],
false, 'Committed')
.then(function(containerRequest) {
+ // Create empty log file before loading process page
+ cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [
+ ""
+ ])
+
cy.loginAs(activeUser);
cy.goToPath(`/processes/${containerRequest.uuid}`);
cy.get('[data-cy=process-details]').should('contain', crName);
.should('contain', 'No logs yet')
.and('not.contain', 'hello world');
+ // Append a log line
cy.appendLog(adminUser.token, containerRequest.uuid, "stdout.txt", [
"2023-07-18T20:14:48.128642814Z hello world"
]).then(() => {
.and('contain', 'hello world');
});
+ // Append new log line to different file
cy.appendLog(adminUser.token, containerRequest.uuid, "stderr.txt", [
"2023-07-18T20:14:49.128642814Z hello new line"
]).then(() => {
// Switch to All logs
cy.get('[data-cy=process-logs-filter]').click();
cy.get('body').contains('li', 'All logs').click();
- // Verify sorted logs
+ // Verify non-sorted lines were preserved
cy.get('[data-cy=process-logs] pre')
- .eq(0).should('contain', '2023-07-18T20:14:48.128642814Z first');
+ .eq(0).should('contain', '3: nodeinfo 1');
cy.get('[data-cy=process-logs] pre')
- .eq(1).should('contain', '2023-07-18T20:14:48.528642814Z second');
+ .eq(1).should('contain', '2: nodeinfo 2');
cy.get('[data-cy=process-logs] pre')
- .eq(2).should('contain', '2023-07-18T20:14:49.128642814Z third');
- // Verify non-sorted lines were preserved
+ .eq(2).should('contain', '1: nodeinfo 3');
cy.get('[data-cy=process-logs] pre')
- .eq(3).should('contain', '3: nodeinfo 1');
+ .eq(3).should('contain', '2: nodeinfo 4');
cy.get('[data-cy=process-logs] pre')
- .eq(4).should('contain', '2: nodeinfo 2');
+ .eq(4).should('contain', '3: nodeinfo 5');
+ // Verify sorted logs
cy.get('[data-cy=process-logs] pre')
- .eq(5).should('contain', '1: nodeinfo 3');
+ .eq(5).should('contain', '2023-07-18T20:14:48.128642814Z first');
cy.get('[data-cy=process-logs] pre')
- .eq(6).should('contain', '2: nodeinfo 4');
+ .eq(6).should('contain', '2023-07-18T20:14:48.528642814Z second');
cy.get('[data-cy=process-logs] pre')
- .eq(7).should('contain', '3: nodeinfo 5');
+ .eq(7).should('contain', '2023-07-18T20:14:49.128642814Z third');
});
});
});