-
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
Create POC of Fix dev spaces devfile api tests to avoid using an absolute devfile registry for PHP stack #23200
Create POC of Fix dev spaces devfile api tests to avoid using an absolute devfile registry for PHP stack #23200
Conversation
kubernetesCommandLineToolsExecutor.loginToOcp(); | ||
}); | ||
|
||
test('Create PHP DevSpace', async function (): Promise<void> { |
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.
Did you mean PHP workspace
?
}); | ||
|
||
test('Create PHP DevSpace', async function (): Promise<void> { | ||
kubernetesCommandLineToolsExecutor.namespace = 'admin-devspaces'; |
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.
The test will be supporting both Eclipse Che and Dev Spaces if use TS_API_TEST_NAMESPACE
constant:
kubernetesCommandLineToolsExecutor.namespace: string = API_TEST_CONSTANTS.TS_API_TEST_NAMESPACE || "admin-devspaces"
@musienko-maxim : the test seems to be the translation of ApiTest_Php.groovy Jenkins script to the typescript, which looks like a step back compare to the another approach which was implemented in the https://github.com/eclipse-che/che/blob/main/tests/e2e/specs/api/DevfileAcceptanceTestAPI.spec.ts, when we are taking commands to execute from devworkspace configuration (see the issue #21514). It was actually expected to see fixed https://github.com/eclipse-che/che/blob/main/tests/e2e/specs/api/DevfileAcceptanceTestAPI.spec.ts script, to get devworkspace configuration from dashbaord API, not from devfile registry. Sample name to test could be defined by environment variable |
@musienko-maxim : after the call with you I have changed my mind and think that this approach could also be applied, even though it will be a big chunk of work to write test for each devfile sample separately. Let's try it on Jenkins CI: https://main-jenkins-csb-crwqe.apps.ocp-c1.prod.psi.redhat.com/job/Testing/job/e2e/job/basic/job/typescript-tests/28674/ It would also be great to finish clean up of devfile registry specific code carefully, like |
const workdir:string = YAML.parse(devfileContent).commands[0].exec.workingDir; | ||
const commandLine:string = YAML.parse(devfileContent).commands[0].exec.commandLine; | ||
const containerName:string = YAML.parse(devfileContent).commands[0].exec.component; | ||
const runCommandInBash:string = `cd ${workdir} && ${commandLine}`; |
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 would also be useful to see the actual values of workdir
and commandLine
: in the logs to recognize original values and the command created from them.
kubernetesCommandLineToolsExecutor.namespace = 'admin-devspaces'; | ||
devfileContent = devfilesRegistryHelper.getDevfileContent('php'); | ||
const editorDevfileContent: string = devfilesRegistryHelper.obtainCheDevFileEditorFromCheConfigMap('editors-definitions'); | ||
kubernetesCommandLineToolsExecutor.workspaceName = YAML.parse(devfileContent).metadata.name; |
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.
If we add a random string to the end of workspace name to avoid conflict with existed workspaces having the same name.
|
||
test('Create PHP DevSpace', async function (): Promise<void> { | ||
kubernetesCommandLineToolsExecutor.namespace = 'admin-devspaces'; | ||
devfileContent = devfilesRegistryHelper.getDevfileContent('php'); |
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.
'php' would better to extract as a DEVFILE_ID constant to make localizing the sample name simpler when investigate the test failure.
You can extract devfile ids of Dev Spaces 3.16 from the next json obtained using request `curl -X GET http://localhost:8081/dashboard/api/airgap-sample -H 'accept: /' -H 'Authorization: Bearer ...:
[INFO] Devfiles metadata content:
[
{
"id": "php",
"displayName": "PHP",
"description": "PHP Stack with PHP",
"tags": [
"Tech-Preview",
"PHP",
"UBI8"
],
"url": "http://devspaces-dashboard.openshift-devspaces.svc:8080/dashboard/api/airgap-sample/devfile/download?id=php",
"icon": {
"mediatype": "image/svg+xml"
},
"project": {
"zip": {
"filename": "devspaces-samples-php-hello-world-devspaces-3.16-rhel-8.zip"
}
},
"devfile": {
"filename": "devspaces-samples-php-hello-world-devspaces-3.16-rhel-8-devfile.yaml"
}
},
{
"id": "dotnet",
"displayName": ".NET",
"description": ".NET stack with .NET Core SDK 8, Runtime, C# Language Support and Debugger",
"tags": [
"Tech-Preview",
".NET",
"C#",
".NET SDK",
".NET Runtime",
"Netcoredbg",
"Omnisharp",
"UBI8"
],
"url": "http://devspaces-dashboard.openshift-devspaces.svc:8080/dashboard/api/airgap-sample/devfile/download?id=dotnet",
"icon": {
"mediatype": "image/svg+xml"
},
"project": {
"zip": {
"filename": "devspaces-samples-dotnet-web-simple-devspaces-3.16-rhel-8.zip"
}
},
"devfile": {
"filename": "devspaces-samples-dotnet-web-simple-devspaces-3.16-rhel-8-devfile.yaml"
}
},
{
"id": "nodejs-mongodb",
"displayName": "Node.js MongoDB",
"description": "Node.js stack with NPM 8, Node.js 16 and MongoDB 3.6",
"tags": [
"Node.js",
"NPM",
"Express",
"MongoDB",
"UBI8"
],
"url": "http://devspaces-dashboard.openshift-devspaces.svc:8080/dashboard/api/airgap-sample/devfile/download?id=nodejs-mongodb",
"icon": {
"mediatype": "image/svg+xml"
},
"project": {
"zip": {
"filename": "devspaces-samples-nodejs-mongodb-sample-devspaces-3.16-rhel-8.zip"
}
},
"devfile": {
"filename": "devspaces-samples-nodejs-mongodb-sample-devspaces-3.16-rhel-8-devfile.yaml"
}
},
{
"id": "java-lombok",
"displayName": "Java Lombok",
"description": "Java Stack with Project Lombok",
"tags": [
"Java",
"OpenJDK",
"Maven",
"Lombok",
"UBI8"
],
"url": "http://devspaces-dashboard.openshift-devspaces.svc:8080/dashboard/api/airgap-sample/devfile/download?id=java-lombok",
"icon": {
"mediatype": "image/svg+xml"
},
"project": {
"zip": {
"filename": "devspaces-samples-lombok-project-sample-devspaces-3.16-rhel-8.zip"
}
},
"devfile": {
"filename": "devspaces-samples-lombok-project-sample-devspaces-3.16-rhel-8-devfile.yaml"
}
},
{
"id": "nodejs-express",
"displayName": "Node.js Express",
"description": "Node.js stack with NPM 8, Node.js 16 and Express Web Application",
"tags": [
"Node.js",
"NPM",
"Express",
"UBI8"
],
"url": "http://devspaces-dashboard.openshift-devspaces.svc:8080/dashboard/api/airgap-sample/devfile/download?id=nodejs-express",
"icon": {
"mediatype": "image/svg+xml"
},
"project": {
"zip": {
"filename": "devspaces-samples-web-nodejs-sample-devspaces-3.16-rhel-8.zip"
}
},
"devfile": {
"filename": "devspaces-samples-web-nodejs-sample-devspaces-3.16-rhel-8-devfile.yaml"
}
},
{
"id": "cpp",
"displayName": "C/C++",
"description": "C and C++ Developer Tools stack with GCC, cmake and make",
"tags": [
"Tech-Preview",
"C",
"C++",
"Clang",
"GCC",
"g++",
"make",
"cmake",
"UBI8"
],
"url": "http://devspaces-dashboard.openshift-devspaces.svc:8080/dashboard/api/airgap-sample/devfile/download?id=cpp",
"icon": {
"mediatype": "image/svg+xml"
},
"project": {
"zip": {
"filename": "devspaces-samples-c-plus-plus-devspaces-3.16-rhel-8.zip"
}
},
"devfile": {
"filename": "devspaces-samples-c-plus-plus-devspaces-3.16-rhel-8-devfile.yaml"
}
},
{
"id": "ansible",
"displayName": "Ansible",
"description": "Development environment for Ansible playbook creation, testing with Molecule, and ansible-lint checks",
"tags": [
"Community",
"Ansible",
"Molecule"
],
"url": "http://devspaces-dashboard.openshift-devspaces.svc:8080/dashboard/api/airgap-sample/devfile/download?id=ansible",
"icon": {
"mediatype": "image/svg+xml"
},
"project": {
"zip": {
"filename": "devspaces-samples-ansible-devspaces-demo-devspaces-3.16-rhel-8.zip"
}
},
"devfile": {
"filename": "devspaces-samples-ansible-devspaces-demo-devspaces-3.16-rhel-8-devfile.yaml"
}
},
{
"id": "quarkus-rest-api",
"displayName": "Quarkus REST API",
"description": "Quarkus stack with a default REST endpoint application sample",
"tags": [
"Java",
"OpenJDK",
"Maven",
"Quarkus",
"UBI8"
],
"url": "http://devspaces-dashboard.openshift-devspaces.svc:8080/dashboard/api/airgap-sample/devfile/download?id=quarkus-rest-api",
"icon": {
"mediatype": "image/svg+xml"
},
"project": {
"zip": {
"filename": "devspaces-samples-quarkus-quickstarts-devspaces-3.16-rhel-8.zip"
}
},
"devfile": {
"filename": "devspaces-samples-quarkus-quickstarts-devspaces-3.16-rhel-8-devfile.yaml"
}
},
{
"id": "go",
"displayName": "Go",
"description": "Stack with Go",
"tags": [
"Tech-Preview",
"Go",
"Golang",
"UBI8"
],
"url": "http://devspaces-dashboard.openshift-devspaces.svc:8080/dashboard/api/airgap-sample/devfile/download?id=go",
"icon": {
"mediatype": "image/svg+xml"
},
"project": {
"zip": {
"filename": "devspaces-samples-golang-health-check-devspaces-3.16-rhel-8.zip"
}
},
"devfile": {
"filename": "devspaces-samples-golang-health-check-devspaces-3.16-rhel-8-devfile.yaml"
}
},
{
"id": "python",
"displayName": "Python",
"description": "Python Stack with Python 3.9 and pip",
"tags": [
"Python",
"pip",
"UBI8"
],
"url": "http://devspaces-dashboard.openshift-devspaces.svc:8080/dashboard/api/airgap-sample/devfile/download?id=python",
"icon": {
"mediatype": "image/svg+xml"
},
"project": {
"zip": {
"filename": "devspaces-samples-python-hello-world-devspaces-3.16-rhel-8.zip"
}
},
"devfile": {
"filename": "devspaces-samples-python-hello-world-devspaces-3.16-rhel-8-devfile.yaml"
}
}
]
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.
PhpDevFileAPI test run against DS 3.17 has passed https://main-jenkins-csb-crwqe.apps.ocp-c1.prod.psi.redhat.com/job/Testing/job/e2e/job/basic/job/typescript-tests/29221/console
Good job, @musienko-maxim !
PR looks good to merge.
What does this PR do?
This PR provides an alternative solution for API tests using our CHE test codebase:
Screenshot/screencast of this PR
What issues does this PR fix or reference?
https://issues.redhat.com/browse/CRW-7539
How to test this PR?
PR 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.