Skip to content

Commit 5d0a6f9

Browse files
vrubezhnyclaude
andcommitted
Add diagnostic logging to componentCommands test
- Add suite-level timeout of 30s - Add logging to show expected vs actual commands - Use waitForItemStable for more reliable component detection - Temporary commit for debugging CI test failures Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f2c245a commit 5d0a6f9

3 files changed

Lines changed: 27 additions & 7 deletions

File tree

src/devfile/parallelCompositeCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*-----------------------------------------------------------------------------------------------*/
55

6-
import { ComponentWorkspaceFolder } from 'src/odo/workspace';
76
import { Command } from '../odo/componentTypeDescription';
7+
import { ComponentWorkspaceFolder } from '../odo/workspace';
88
import { DevfileCommandRunner } from './devfileCommandRunner';
99

1010
export class ParallelCompositeCommand {

test/integration/command.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import { EventEmitter, Terminal, window, workspace } from 'vscode';
1515
import { parse, stringify } from 'yaml';
1616
import { CommandText } from '../../src/base/command';
1717
import { CliChannel } from '../../src/cli';
18+
import { DevfileCommandRunner } from '../../src/devfile/devfileCommandRunner';
1819
import { Oc } from '../../src/oc/ocWrapper';
1920
import { Command } from '../../src/odo/command';
2021
import { OdoPreference } from '../../src/odo/odoPreference';
2122
import { Odo } from '../../src/odo/odoWrapper';
23+
import { ComponentWorkspaceFolder } from '../../src/odo/workspace';
2224
import { LoginUtil } from '../../src/util/loginUtil';
2325
import { YAML_STRINGIFY_OPTIONS } from '../../src/util/utils';
24-
import { ComponentWorkspaceFolder } from 'src/odo/workspace';
25-
import { DevfileCommandRunner } from '../../src/devfile/devfileCommandRunner';
2626

2727
const ODO = Odo.Instance;
2828

test/ui/suite/componentCommands.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ import {
1717
Workbench,
1818
} from 'vscode-extension-tester';
1919
import { parse } from 'yaml';
20-
import { itemExists } from '../common/conditions';
20+
import { waitForItemStable, warn, log } from '../common/conditions';
2121
import { VIEWS } from '../common/constants';
2222
import { reloadWindow } from '../common/overdrives';
2323
import { OpenshiftTerminalWebviewView } from '../common/ui/webviewView/openshiftTerminalWebviewView';
2424

2525
export function testComponentCommands(path: string) {
2626
describe('Component Commands', function () {
27+
this.timeout(30_000);
28+
2729
let view: SideBarView;
2830
let section: ViewSection;
2931
let commands: TreeItem[];
@@ -46,10 +48,21 @@ export function testComponentCommands(path: string) {
4648
}
4749

4850
// expect component is running
49-
section = await view.getContent().getSection(VIEWS.components);
51+
// section = await view.getContent().getSection(VIEWS.components);
52+
// try {
53+
// await itemExists(`${componentName} (dev running)`, section);
54+
// } catch {
55+
// this.skip();
56+
// }
5057
try {
51-
await itemExists(`${componentName} (dev running)`, section);
52-
} catch {
58+
const componentInDevName = `${componentName} (dev running)`;
59+
const item = await waitForItemStable(getSection, componentInDevName, true, 40_000);
60+
if (!item) {
61+
warn(`Component "${componentName}" not found or isn't running in Dev, skipping tests`);
62+
this.skip();
63+
}
64+
} catch (err) {
65+
warn('Error in before hook: "Component Commands":', err);
5366
this.skip();
5467
}
5568
});
@@ -69,6 +82,8 @@ export function testComponentCommands(path: string) {
6982
expectedCommands.push(command.id);
7083
});
7184

85+
log(`Expected commands: ${JSON.stringify(expectedCommands)}`);
86+
7287
//get component
7388
const components = await section.getVisibleItems();
7489
const component = components[0] as TreeItem;
@@ -84,6 +99,7 @@ export function testComponentCommands(path: string) {
8499
for (const command of commands) {
85100
actualCommands.push(await command.getLabel());
86101
}
102+
log(`Actual commands: ${JSON.stringify(actualCommands)}`);
87103
expect(actualCommands).to.include.members(expectedCommands);
88104
});
89105

@@ -117,5 +133,9 @@ export function testComponentCommands(path: string) {
117133

118134
expect(terminalText).to.contain('Press any key to close this terminal');
119135
});
136+
137+
async function getSection(): Promise<ViewSection> {
138+
return await view.getContent().getSection(VIEWS.components);
139+
}
120140
});
121141
}

0 commit comments

Comments
 (0)