Skip to content

Commit

Permalink
Update Node devfile tests (#3459)
Browse files Browse the repository at this point in the history
* Update Node test devfile

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* Update node test template check in test

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* resolved devfile debug tests

* revert devfile vol changes

Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>

* removed unnecessary git clones

* resolved serial debug test

* resolved failing docker test

Co-authored-by: Girish Ramnani <gramnani@redhat.com>
  • Loading branch information
maysunfaisal and Girish Ramnani authored Jul 1, 2020
1 parent 79bba03 commit 72996e0
Show file tree
Hide file tree
Showing 23 changed files with 211 additions and 138 deletions.
8 changes: 4 additions & 4 deletions docs/public/debugging-using-devfile.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
name: test-devfile
projects:
-
name: nodejs-web-app
name: nodejs-starter
source:
type: git
location: "https://github.com/che-samples/web-nodejs-sample.git"
Expand All @@ -32,19 +32,19 @@ commands:
- type: exec
component: runtime
command: "npm install"
workdir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
workdir: ${CHE_PROJECTS_ROOT}/nodejs-starter/app
- name: devrun
actions:
- type: exec
component: runtime
command: "nodemon app.js"
workdir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
workdir: ${CHE_PROJECTS_ROOT}/nodejs-starter/app
- name: debugrun
actions:
- type: exec
component: runtime
command: "nodemon --inspect=${DEBUG_PORT}"
workdir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/
workdir: ${CHE_PROJECTS_ROOT}/nodejs-starter/
```

- Now we need to create the component using `odo create nodejs`
Expand Down
4 changes: 2 additions & 2 deletions pkg/odo/cli/component/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ Note: When you use odo with experimental mode enabled and create devfile compone
# Create new Node.js component with custom ports, additional environment variables and memory and cpu limits
%[1]s nodejs --port 8080,8100/tcp,9100/udp --env key=value,key1=value1 --memory 4Gi --cpu 2
# Create new Node.js component and download the sample project named nodejs-web-app
%[1]s nodejs --downloadSource=nodejs-web-app`)
# Create new Node.js component and download the sample project named nodejs-starter
%[1]s nodejs --downloadSource=nodejs-starter`)

const defaultProjectName = "devfile-project-name"

Expand Down
14 changes: 7 additions & 7 deletions tests/examples/source/devfiles/nodejs/devfile-no-endpoints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@ schemaVersion: 2.0.0
metadata:
name: test-devfile
projects:
- name: nodejs-web-app
- name: nodejs-starter
git:
location: "https://github.com/che-samples/web-nodejs-sample.git"
location: "https://github.com/odo-devfiles/nodejs-ex.git"
components:
- container:
name: runtime
image: quay.io/eclipse/che-nodejs10-ubi:nightly
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
memoryLimit: 1024Mi
mountSources: true
commands:
- exec:
id: devbuild
component: runtime
commandLine: "npm install"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm install
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: build
isDefault: true
- exec:
id: devrun
component: runtime
commandLine: "nodemon app.js"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm start
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: run
isDefault: true
18 changes: 9 additions & 9 deletions tests/examples/source/devfiles/nodejs/devfile-with-debugrun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ schemaVersion: 2.0.0
metadata:
name: test-devfile
projects:
- name: nodejs-web-app
- name: nodejs-starter
git:
location: "https://github.com/che-samples/web-nodejs-sample.git"
location: "https://github.com/odo-devfiles/nodejs-ex.git"
components:
- container:
name: runtime
image: quay.io/eclipse/che-nodejs10-ubi:nightly
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
memoryLimit: 1024Mi
endpoints:
- name: "3000/tcp"
Expand All @@ -21,24 +21,24 @@ commands:
- exec:
id: devbuild
component: runtime
commandLine: "npm install"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm install
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: build
isDefault: true
- exec:
id: devrun
component: runtime
commandLine: "nodemon app.js"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm start
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: run
isDefault: true
- exec:
id: debugrun
component: runtime
commandLine: "nodemon --inspect=${DEBUG_PORT}"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/
commandLine: npm run debug
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: debug
isDefault: true
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ schemaVersion: 2.0.0
metadata:
name: test-devfile
projects:
- name: nodejs-web-app
- name: nodejs-starter
git:
location: "https://github.com/che-samples/web-nodejs-sample.git"
location: "https://github.com/odo-devfiles/nodejs-ex.git"
components:
- container:
name: runtime
image: quay.io/eclipse/che-nodejs10-ubi:nightly
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
memoryLimit: 1024Mi
endpoints:
- name: "3000/tcp"
Expand All @@ -21,35 +21,35 @@ commands:
- exec:
id: firstbuild
component: runtime
commandLine: "npm install"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm install
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: build
isDefault: true
- exec:
id: secondbuild
component: runtime
commandLine: "npm install"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm install
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: build
isDefault: true
- exec:
id: thirdbuild
component: runtime
commandLine: "npm install"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm install
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
- exec:
id: firstrun
component: runtime
commandLine: "nodemon app.js"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm start
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: run
- exec:
id: secondrun
component: runtime
commandLine: "nodemon app.js"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm start
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: run
14 changes: 7 additions & 7 deletions tests/examples/source/devfiles/nodejs/devfile-with-restart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ schemaVersion: 2.0.0
metadata:
name: test-devfile
projects:
- name: nodejs-web-app
- name: nodejs-starter
git:
location: "https://github.com/che-samples/web-nodejs-sample.git"
location: "https://github.com/odo-devfiles/nodejs-ex.git"
components:
- container:
name: runtime
image: quay.io/eclipse/che-nodejs10-ubi:nightly
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
memoryLimit: 1024Mi
mountSources: true
commands:
- exec:
id: devbuild
component: runtime
commandLine: "npm install"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm install
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: build
isDefault: true
Expand All @@ -25,8 +25,8 @@ commands:
attributes:
restart: "false"
component: runtime
commandLine: "nodemon app.js"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm start
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: run
isDefault: true
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ metadata:
name: test-devfile
projects:
-
name: nodejs-web-app
name: nodejs-starter
source:
type: git
location: "https://github.com/che-samples/web-nodejs-sample.git"
sparseCheckoutDir: /app/
components:
- type: dockerimage
image: quay.io/eclipse/che-nodejs10-ubi:nightly
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
endpoints:
- name: "3000/tcp"
port: 3000
Expand All @@ -25,23 +25,23 @@ commands:
actions:
- type: exec
component: runtime
command: "npm install"
workdir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
command: npm install
workdir: ${CHE_PROJECTS_ROOT}/nodejs-starter
- name: devbuild
actions:
- type: exec
component: runtime
command: "npm install"
workdir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
command: npm install
workdir: ${CHE_PROJECTS_ROOT}/nodejs-starter
- name: run
actions:
- type: exec
component: runtime
command: "nodemon app.js"
workdir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
command: npm start
workdir: ${CHE_PROJECTS_ROOT}/nodejs-starter
- name: devrun
actions:
- type: exec
component: runtime
command: "nodemon app.js"
workdir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
command: npm start
workdir: ${CHE_PROJECTS_ROOT}/nodejs-starter
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ schemaVersion: 2.0.0
metadata:
name: test-devfile
projects:
- name: nodejs-web-app
- name: nodejs-starter
git:
location: "https://github.com/che-samples/web-nodejs-sample.git"
components:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ schemaVersion: 2.0.0
metadata:
name: test-devfile
projects:
- name: nodejs-web-app
- name: nodejs-starter
git:
location: "https://github.com/che-samples/web-nodejs-sample.git"
location: "https://github.com/odo-devfiles/nodejs-ex.git"
components:
- container:
name: runtime
image: quay.io/eclipse/che-nodejs10-ubi:nightly
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
memoryLimit: 1024Mi
env:
- name: FOO
Expand All @@ -24,8 +24,8 @@ commands:
- exec:
id: devrun
component: runtime
commandLine: "npm install && nodemon app.js"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: "npm install && npm start"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: run
isDefault: true
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ schemaVersion: 2.0.0
metadata:
name: test-devfile
projects:
- name: nodejs-web-app
- name: nodejs-starter
git:
location: "https://github.com/che-samples/web-nodejs-sample.git"
location: "https://github.com/odo-devfiles/nodejs-ex.git"
components:
- container:
name: runtime
Expand All @@ -24,16 +24,16 @@ commands:
- exec:
id: devbuild
component: runtime
commandLine: "npm install"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm install
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: build
isDefault: true
- exec:
id: devrun
component: runtime
commandLine: "nodemon app.js"
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-web-app/app
commandLine: npm start
workingDir: ${CHE_PROJECTS_ROOT}/nodejs-starter
group:
kind: run
isDefault: true
Loading

0 comments on commit 72996e0

Please sign in to comment.