-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'CppDevFileAPI' E2E test #23289
Add 'CppDevFileAPI' E2E test #23289
Conversation
const toolsComponent: any = YAML.parse(devfileContent).components.find((component: any): boolean => component.name === 'tools'); | ||
const containerName: string = toolsComponent ? toolsComponent.name : 'Component not found'; | ||
Logger.info(`container from components section of Devfile:: ${containerName}`); | ||
runCommandInBash = `cd ${workDirPath} && ${buildCommand}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important to test build command extracted from C++ sample devfile together with workDir property, not hard-coded in the test itself.
Example of command extraction can be found in the in the code https://github.com/eclipse-che/che/blob/main/tests/e2e/specs/api/PythonDevFileAPI.spec.ts#L63-L64
expect(output.code).eqls(0); | ||
expect(output.stdout.trim()).contains('Build complete'); | ||
Logger.info('Check run command'); | ||
runCommandInBash = `cd ${workDirPath} && ${runCommand}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important to test run command extracted from C++ sample devfile together with workDir property, not hard-coded in the test itself.
Example of command extraction can be found in the in the code https://github.com/eclipse-che/che/blob/main/tests/e2e/specs/api/PythonDevFileAPI.spec.ts#L63-L64
let devWorkspaceConfigurationHelper: DevWorkspaceConfigurationHelper; | ||
let devfileContext: DevfileContext; | ||
let devfileContent: string = ''; | ||
const workDirPath: string = 'c-plus-plus/strings'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be extracted from the devfile yaml for particular command
See an example in https://github.com/eclipse-che/che/blob/main/tests/e2e/specs/api/PythonDevFileAPI.spec.ts#L63
let devfileContext: DevfileContext; | ||
let devfileContent: string = ''; | ||
const workDirPath: string = 'c-plus-plus/strings'; | ||
const buildCommand: string = 'rm -f bin.out && g++ -g "knuth_morris_pratt.cpp" -o bin.out && echo "Build complete"'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build command should be extracted from the devfile yaml of C++ sample.
See an example in https://github.com/eclipse-che/che/blob/main/tests/e2e/specs/api/PythonDevFileAPI.spec.ts#L64
let devfileContent: string = ''; | ||
const workDirPath: string = 'c-plus-plus/strings'; | ||
const buildCommand: string = 'rm -f bin.out && g++ -g "knuth_morris_pratt.cpp" -o bin.out && echo "Build complete"'; | ||
const runCommand: string = './bin.out'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run command should be extracted from the devfile yaml of C++ sample.
See an example in https://github.com/eclipse-che/che/blob/main/tests/e2e/specs/api/PythonDevFileAPI.spec.ts#L64
@dmytro-ndp I would do so, if C++ sample had |
Thank you for the explanation, @artaleks9 ! |
| It would be appreciated if you could implement the code which extracts the commands to execute from .vscode/tasks.json file in the project. Done.
|
What does this PR do?
CppDevFileAPI
test to check command execution ofcpp
sampleScreenshot/screencast of this PR
What issues does this PR fix or reference?
How to test this PR?
Run the
CppDevFileAPI.spec.ts
as usualPR Checklist
As the author of this Pull Request I made sure that:
What issues does this PR fix or reference
andHow to test this PR
completedReviewers
Reviewers, please comment how you tested the PR when approving it.