Skip to content

Commit 8fc0998

Browse files
committed
fix quarkus commands
1 parent 90e9589 commit 8fc0998

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

tests/e2e/specs/api/QuarkusDevFileAPI.spec.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ suite('Quarkus devfile API test', function (): void {
7272
runCommandInBash = `cd ${workdir} && ` + runCommandInBash;
7373
}
7474

75-
const output: ShellString = containerTerminal.execInContainerCommand(runCommandInBash, containerName);
75+
const output: ShellString = containerTerminal.execInContainerCommand(runCommandInBash, containerName, '5m');
7676
expect(output.code).eqls(0);
7777
expect(output.stdout.trim()).contains('BUILD SUCCESS');
7878
});
@@ -86,12 +86,15 @@ suite('Quarkus devfile API test', function (): void {
8686

8787
let runCommandInBash: string = commandLine.replaceAll('$', '\\$'); // don't wipe out env. vars like "${PROJECTS_ROOT}"
8888
if (workdir !== undefined && workdir !== '') {
89-
runCommandInBash = `cd ${workdir} && ` + runCommandInBash;
89+
runCommandInBash = `cd ${workdir} && sh -c "(` + runCommandInBash + ' > server.log 2>&1 &) && exit"';
9090
}
9191

92-
const output: ShellString = containerTerminal.execInContainerCommand(runCommandInBash, containerName);
93-
expect(output.code).eqls(0);
94-
expect(output.stdout.trim()).contains('Listening for transport dt_socket at address: 5005');
92+
const commandOutput: ShellString = containerTerminal.execInContainerCommand(runCommandInBash, containerName);
93+
expect(commandOutput.code).eqls(0);
94+
95+
const commandLog: ShellString = containerTerminal.execInContainerCommand(`cat ${workdir}/command.log`, containerName);
96+
Logger.info(`Command log: ${commandLog.stdout}`);
97+
expect(commandLog.stdout.trim()).contains('Listening on: http://0.0.0.0:8080');
9598
});
9699

97100
suiteTeardown('Delete workspace', function (): void {

tests/e2e/utils/KubernetesCommandLineToolsExecutor.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,22 @@ export class KubernetesCommandLineToolsExecutor implements IKubernetesCommandLin
124124
return this.waitDevWorkspace();
125125
}
126126

127-
execInContainerCommand(commandToExecute: string, container: string = KubernetesCommandLineToolsExecutor.container): ShellString {
127+
execInContainerCommand(
128+
commandToExecute: string,
129+
container: string = KubernetesCommandLineToolsExecutor.container,
130+
requestTimeout?: string
131+
): ShellString {
128132
Logger.debug(`${this.kubernetesCommandLineTool}`);
129133

130-
return this.shellExecutor.executeCommand(
131-
`${this.kubernetesCommandLineTool} exec -i ${KubernetesCommandLineToolsExecutor.pod} -n ${this.namespace} -c ${container} -- sh -c '${commandToExecute}'`
132-
);
134+
if (requestTimeout) {
135+
return this.shellExecutor.executeCommand(
136+
`${this.kubernetesCommandLineTool} exec -i ${KubernetesCommandLineToolsExecutor.pod} -n ${this.namespace} -c ${container} --request-timeout=${requestTimeout} -- sh -c '${commandToExecute}'`
137+
);
138+
} else {
139+
return this.shellExecutor.executeCommand(
140+
`${this.kubernetesCommandLineTool} exec -i ${KubernetesCommandLineToolsExecutor.pod} -n ${this.namespace} -c ${container} -- sh -c '${commandToExecute}'`
141+
);
142+
}
133143
}
134144

135145
applyYamlConfigurationAsStringOutput(yamlConfiguration: string): ShellString {

0 commit comments

Comments
 (0)