Skip to content

Commit a9bd336

Browse files
authored
parent tests (#110)
1 parent 8bfe0ef commit a9bd336

File tree

8 files changed

+486
-22
lines changed

8 files changed

+486
-22
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/devfile/library
33
go 1.13
44

55
require (
6-
github.com/devfile/api/v2 v2.0.0-20210713153530-f78ab9de1a30
6+
github.com/devfile/api/v2 v2.0.0-20210804191700-4f7b6856e70a
77
github.com/fatih/color v1.7.0
88
github.com/gobwas/glob v0.2.3
99
github.com/golang/mock v1.5.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do
7575
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7676
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
7777
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
78-
github.com/devfile/api/v2 v2.0.0-20210713153530-f78ab9de1a30 h1:DL1o2U9NuS2KpVHva5h3tbIReJfF1LkSTJFj+JRiqJg=
79-
github.com/devfile/api/v2 v2.0.0-20210713153530-f78ab9de1a30/go.mod h1:QNzaIVQnCsYfXed+QZOn1uvEQFzyhvpi/uc3g/b2ws0=
78+
github.com/devfile/api/v2 v2.0.0-20210804191700-4f7b6856e70a h1:mvnXqJAjmdrsUltkE3sOh29UcI+0jKQ8kKKXYkWArNc=
79+
github.com/devfile/api/v2 v2.0.0-20210804191700-4f7b6856e70a/go.mod h1:QNzaIVQnCsYfXed+QZOn1uvEQFzyhvpi/uc3g/b2ws0=
8080
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
8181
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
8282
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=

tests/v2/devfiles/samples/Parent.yaml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
schemaVersion: 2.1.0
2+
commands:
3+
- apply:
4+
component: testcontainerparent1
5+
group:
6+
kind: test
7+
isDefault: true
8+
label: JXTVtfYNNsaiQcqFSwTavCaBlRGMaBOXaxXsgDRxFxsNxbuHfGQuQjBwJWJVmHd
9+
id: testapplyparentcommand1
10+
- id: run
11+
exec:
12+
component: testcontainerparent1
13+
commandLine: npm start
14+
workingDir: /project
15+
group:
16+
kind: run
17+
isDefault: true
18+
hotReloadCapable: true
19+
- id: test
20+
composite:
21+
commands: [testapplyparentcommand1]
22+
group:
23+
kind: debug
24+
label: testcompositeparent1
25+
parallel: true
26+
components:
27+
- container:
28+
image: mKrpiOQnyGZ00003
29+
name: testcontainerparent1
30+
- kubernetes:
31+
inlined: |
32+
apiVersion: batch/v1
33+
kind: Job
34+
metadata:
35+
name: pi
36+
spec:
37+
template:
38+
spec:
39+
containers:
40+
- name: job
41+
image: myimage
42+
command: ["some", "command"]
43+
restartPolicy: Never
44+
name: testkubeparent1
45+
- openshift:
46+
uri: openshift.yaml
47+
name: openshiftcomponent1
48+
projects:
49+
- name: petclinic
50+
git:
51+
remotes:
52+
origin: "https://github.com/spring-projects/spring-petclinic.git"
53+
checkoutFrom:
54+
remote: origin
55+
revision: main
56+
- name: petclinic-dev
57+
zip:
58+
location: https://github.com/spring-projects/spring-petclinic/archive/refs/heads/main.zip
59+
attributes:
60+
editorFree: true
61+
user: default
62+
starterProjects:
63+
- name: user-app
64+
git:
65+
remotes:
66+
origin: 'https://github.com/OpenLiberty/application-stack-starters.git'
67+
description: An Open Liberty Starter project
68+
subDir: /app
69+
attributes:
70+
workingDir: /home
71+
- name: user-app2
72+
zip:
73+
location: 'https://github.com/OpenLiberty/application-stack-starters.zip'
74+
attributes: #only applicable to v2.1.0
75+
category: parentdevfile
76+
title: This is a parent devfile
77+
variables: #only applicable to v2.1.0
78+
version: 2.0.0
79+
tag: parent
80+
lastUpdated: "2020"
81+
82+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
schemaVersion: 2.1.0
2+
parent:
3+
kubernetes:
4+
name: testkubeparent1
5+
namespace: default
6+
commands:
7+
- apply:
8+
component: devbuild
9+
group:
10+
kind: build #override
11+
isDefault: false #override
12+
label: testcontainerparent1 #override
13+
id: applycommand
14+
components:
15+
- container:
16+
image: updatedimage #override
17+
name: devbuild
18+
projects:
19+
- name: parentproject
20+
git:
21+
remotes:
22+
neworigin: "https://github.com/spring-projects/spring-petclinic2.git" #override, should result in 2 remotes in flattened file
23+
checkoutFrom:
24+
remote: neworigin #override
25+
revision: main #override
26+
- name: parentproject2
27+
zip:
28+
location: "https://github.com/spring-projects/spring-petclinic2.zip" #override
29+
starterProjects:
30+
- name: parentstarterproject
31+
git:
32+
remotes:
33+
origin: "https://github.com/spring-projects/spring-petclinic2.git" #override
34+
checkoutFrom:
35+
remote: origin
36+
revision: master #override
37+
attributes: # only applicable to v2.1.0
38+
category: mainDevfile #override
39+
title: This is a main devfile #override
40+
variables: #only applicable to v2.1.0
41+
version: 2.1.0 #override
42+
tag: main #override
43+
44+
45+
46+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
schemaVersion: 2.1.0
2+
parent:
3+
uri: "Parent.yaml"
4+
commands:
5+
- apply:
6+
component: testcontainer1 #override, point to a container in the main devfile
7+
group:
8+
kind: test
9+
isDefault: false #override
10+
label: testcontainerparent #override
11+
id: testapplyparentcommand1
12+
- id: run
13+
exec:
14+
component: testcontainerparent1
15+
commandLine: npm install #override
16+
workingDir: /project2 #override
17+
env: #addition, does not exist in parent
18+
- name: PATH
19+
value: /dir
20+
- name: USER
21+
value: user1
22+
group:
23+
kind: build #override
24+
isDefault: false #override
25+
hotReloadCapable: false #override
26+
- id: test
27+
composite:
28+
commands: [testapplyparentcommand1, run] #override
29+
group:
30+
kind: debug
31+
label: testcompositeparent1
32+
parallel: false #override
33+
components:
34+
- kubernetes:
35+
inlined: | #override
36+
apiVersion: batch/v1
37+
kind: Pod
38+
metadata:
39+
name: pi
40+
namespace: dev
41+
spec:
42+
template:
43+
spec:
44+
containers:
45+
- name: newJob
46+
image: myimage
47+
command: ["some", "command"]
48+
restartPolicy: Never
49+
name: testkubeparent1
50+
- openshift:
51+
uri: openshift2.yaml #override
52+
name: openshiftcomponent1
53+
- container:
54+
image: updatedimage #override
55+
name: testcontainerparent1
56+
projects:
57+
- name: petclinic
58+
git:
59+
remotes:
60+
neworigin: "https://github.com/spring-projects/spring-petclinic2.git" #override, should result in 2 remotes in flattened file
61+
checkoutFrom:
62+
remote: neworigin #override
63+
revision: master #override
64+
- name: petclinic-dev
65+
zip:
66+
location: https://github.com/spring-projects/spring-petclinic/petclinic.zip #override
67+
clonePath: /petclinic #overrides the default
68+
attributes:
69+
editorFree: false #override
70+
user: user1 #override
71+
starterProjects:
72+
- name: user-app
73+
git:
74+
remotes:
75+
origin: 'https://github.com/OpenLiberty/application-stack-starters-new.git' #override
76+
description: An Open Liberty Starter project override #override
77+
subDir: /newapp #override
78+
attributes: #add additional attributes
79+
env: test
80+
user: user1
81+
attributes: # only applicable to v2.1.0
82+
category: mainDevfile #override
83+
title: This is a main devfile #override
84+
variables: #only applicable to v2.1.0
85+
version: 2.1.0 #override
86+
tag: main #override
87+
lastUpdated: "2021" #override
88+
components:
89+
- container:
90+
image: mKrpiOQnyGZ00003
91+
name: testcontainer1
92+
93+
94+
95+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
schemaVersion: 2.1.0
2+
parent:
3+
id: nodejs
4+
registryUrl: "https://registry.stage.devfile.io"
5+
commands:
6+
- id: run
7+
exec:
8+
component: runtime
9+
commandLine: npm install #override
10+
workingDir: /project2 #override
11+
components:
12+
- name: runtime
13+
container:
14+
image: registry.access.redhat.com/ubi8/nodejs-14:dev #override
15+
memoryLimit: 2048Mi #override
16+
mountSources: false #override
17+
sourceMapping: /project2 #override
18+
endpoints:
19+
- name: http-9080 #this will result in a second endpoint
20+
targetPort: 9080
21+
starterProjects:
22+
- name: nodejs-starter
23+
git:
24+
remotes:
25+
origin: "https://github.com/odo-devfiles/nodejs-ex2.git" #override
26+
27+
28+
29+

0 commit comments

Comments
 (0)