Skip to content

Commit 2932065

Browse files
authored
Add kubernetes and openshift tests (#98)
* Add kubernetes and openshift tests * update api version * run go tidy and update go.sum
1 parent 0867af2 commit 2932065

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
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-20210601183841-edb670122352
6+
github.com/devfile/api/v2 v2.0.0-20210615212757-b0014e012b86
77
github.com/fatih/color v1.7.0
88
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
99
github.com/gobwas/glob v0.2.3

go.sum

Lines changed: 2 additions & 2 deletions
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-20210601183841-edb670122352 h1:TgbJxTYSGd23JrNTsPnEcJNstJulCHPKnfcGdJZBNCU=
79-
github.com/devfile/api/v2 v2.0.0-20210601183841-edb670122352/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg=
78+
github.com/devfile/api/v2 v2.0.0-20210615212757-b0014e012b86 h1:UmscUfwS9gUpM1cPdfuewwPDrXCA5cy8WEJ1HQDgtSA=
79+
github.com/devfile/api/v2 v2.0.0-20210615212757-b0014e012b86/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg=
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/libraryTest/library_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func Test_MultiCommand(t *testing.T) {
8080
}
8181

8282
func Test_ContainerComponent(t *testing.T) {
83+
8384
testContent := commonUtils.TestContent{}
8485
testContent.ComponentTypes = []schema.ComponentType{schema.ContainerComponentType}
8586
testContent.EditContent = false
@@ -97,6 +98,42 @@ func Test_ContainerComponentEdit(t *testing.T) {
9798
libraryUtils.RunMultiThreadTest(testContent, t)
9899
}
99100

101+
func Test_KubernetesComponent(t *testing.T) {
102+
testContent := commonUtils.TestContent{}
103+
testContent.ComponentTypes = []schema.ComponentType{schema.KubernetesComponentType}
104+
testContent.EditContent = false
105+
testContent.FileName = commonUtils.GetDevFileName()
106+
libraryUtils.RunTest(testContent, t)
107+
libraryUtils.RunMultiThreadTest(testContent, t)
108+
}
109+
110+
func Test_KubernetesComponentEdit(t *testing.T) {
111+
testContent := commonUtils.TestContent{}
112+
testContent.ComponentTypes = []schema.ComponentType{schema.KubernetesComponentType}
113+
testContent.EditContent = true
114+
testContent.FileName = commonUtils.GetDevFileName()
115+
libraryUtils.RunTest(testContent, t)
116+
libraryUtils.RunMultiThreadTest(testContent, t)
117+
}
118+
119+
func Test_OpenshiftComponent(t *testing.T) {
120+
testContent := commonUtils.TestContent{}
121+
testContent.ComponentTypes = []schema.ComponentType{schema.OpenshiftComponentType}
122+
testContent.EditContent = false
123+
testContent.FileName = commonUtils.GetDevFileName()
124+
libraryUtils.RunTest(testContent, t)
125+
libraryUtils.RunMultiThreadTest(testContent, t)
126+
}
127+
128+
func Test_OpenshiftComponentEdit(t *testing.T) {
129+
testContent := commonUtils.TestContent{}
130+
testContent.ComponentTypes = []schema.ComponentType{schema.OpenshiftComponentType}
131+
testContent.EditContent = true
132+
testContent.FileName = commonUtils.GetDevFileName()
133+
libraryUtils.RunTest(testContent, t)
134+
libraryUtils.RunMultiThreadTest(testContent, t)
135+
}
136+
100137
func Test_VolumeComponent(t *testing.T) {
101138
testContent := commonUtils.TestContent{}
102139
testContent.ComponentTypes = []schema.ComponentType{schema.VolumeComponentType}

tests/v2/utils/library/component_test_utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ func UpdateComponent(devfile *commonUtils.TestDevfile, componentName string) err
3434
commonUtils.LogInfoMessage(fmt.Sprintf("....... Updating component name: %s", componentName))
3535
if testComponent.Container != nil {
3636
devfile.SetContainerComponentValues(testComponent)
37+
} else if testComponent.Kubernetes != nil {
38+
devfile.SetK8sComponentValues(testComponent)
39+
} else if testComponent.Openshift != nil {
40+
devfile.SetK8sComponentValues(testComponent)
3741
} else if testComponent.Volume != nil {
3842
devfile.SetVolumeComponentValues(testComponent)
3943
} else {

0 commit comments

Comments
 (0)