Skip to content
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 kubernetes and openshift tests #98

Merged
merged 3 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/devfile/library
go 1.13

require (
github.com/devfile/api/v2 v2.0.0-20210601183841-edb670122352
github.com/devfile/api/v2 v2.0.0-20210615212757-b0014e012b86
github.com/fatih/color v1.7.0
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/gobwas/glob v0.2.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/devfile/api/v2 v2.0.0-20210601183841-edb670122352 h1:TgbJxTYSGd23JrNTsPnEcJNstJulCHPKnfcGdJZBNCU=
github.com/devfile/api/v2 v2.0.0-20210601183841-edb670122352/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg=
github.com/devfile/api/v2 v2.0.0-20210615212757-b0014e012b86 h1:UmscUfwS9gUpM1cPdfuewwPDrXCA5cy8WEJ1HQDgtSA=
github.com/devfile/api/v2 v2.0.0-20210615212757-b0014e012b86/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
Expand Down
37 changes: 37 additions & 0 deletions tests/v2/libraryTest/library_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func Test_MultiCommand(t *testing.T) {
}

func Test_ContainerComponent(t *testing.T) {

testContent := commonUtils.TestContent{}
testContent.ComponentTypes = []schema.ComponentType{schema.ContainerComponentType}
testContent.EditContent = false
Expand All @@ -97,6 +98,42 @@ func Test_ContainerComponentEdit(t *testing.T) {
libraryUtils.RunMultiThreadTest(testContent, t)
}

func Test_KubernetesComponent(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.ComponentTypes = []schema.ComponentType{schema.KubernetesComponentType}
testContent.EditContent = false
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}

func Test_KubernetesComponentEdit(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.ComponentTypes = []schema.ComponentType{schema.KubernetesComponentType}
testContent.EditContent = true
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}

func Test_OpenshiftComponent(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.ComponentTypes = []schema.ComponentType{schema.OpenshiftComponentType}
testContent.EditContent = false
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}

func Test_OpenshiftComponentEdit(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.ComponentTypes = []schema.ComponentType{schema.OpenshiftComponentType}
testContent.EditContent = true
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}

func Test_VolumeComponent(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.ComponentTypes = []schema.ComponentType{schema.VolumeComponentType}
Expand Down
4 changes: 4 additions & 0 deletions tests/v2/utils/library/component_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func UpdateComponent(devfile *commonUtils.TestDevfile, componentName string) err
commonUtils.LogInfoMessage(fmt.Sprintf("....... Updating component name: %s", componentName))
if testComponent.Container != nil {
devfile.SetContainerComponentValues(testComponent)
} else if testComponent.Kubernetes != nil {
devfile.SetK8sComponentValues(testComponent)
} else if testComponent.Openshift != nil {
devfile.SetK8sComponentValues(testComponent)
} else if testComponent.Volume != nil {
devfile.SetVolumeComponentValues(testComponent)
} else {
Expand Down