diff --git a/go.mod b/go.mod index 34728ea4..188098bd 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/devfile/library go 1.13 require ( - github.com/devfile/api/v2 v2.0.0-20210615212757-b0014e012b86 + github.com/devfile/api/v2 v2.0.0-20210623152004-b08e48618403 github.com/fatih/color v1.7.0 github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 github.com/gobwas/glob v0.2.3 diff --git a/go.sum b/go.sum index 544cbe55..ee5c5dd9 100644 --- a/go.sum +++ b/go.sum @@ -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-20210615212757-b0014e012b86 h1:UmscUfwS9gUpM1cPdfuewwPDrXCA5cy8WEJ1HQDgtSA= -github.com/devfile/api/v2 v2.0.0-20210615212757-b0014e012b86/go.mod h1:Cot4snybn3qhIh48oIFi9McocnIx7zY5fFbjfrIpPvg= +github.com/devfile/api/v2 v2.0.0-20210623152004-b08e48618403 h1:5Cyt6BucdDKwaW1LaftbJt6P2tpR1GjF/b9GpO5NFmg= +github.com/devfile/api/v2 v2.0.0-20210623152004-b08e48618403/go.mod h1:QNzaIVQnCsYfXed+QZOn1uvEQFzyhvpi/uc3g/b2ws0= 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= @@ -271,6 +271,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/lucasjones/reggen v0.0.0-20200904144131-37ba4fa293bb h1:w1g9wNDIE/pHSTmAaUhv4TZQuPBS6GV3mMz5hkgziIU= +github.com/lucasjones/reggen v0.0.0-20200904144131-37ba4fa293bb/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= diff --git a/tests/v2/libraryTest/library_test.go b/tests/v2/libraryTest/library_test.go index 6c04fecb..bbbf9815 100644 --- a/tests/v2/libraryTest/library_test.go +++ b/tests/v2/libraryTest/library_test.go @@ -8,14 +8,6 @@ import ( libraryUtils "github.com/devfile/library/tests/v2/utils/library" ) -// TestContent - structure used by a test to configure the tests to run -type TestContent struct { - CommandTypes []schema.CommandType - ComponentTypes []schema.ComponentType - FileName string - EditContent bool -} - func Test_ExecCommand(t *testing.T) { testContent := commonUtils.TestContent{} testContent.CommandTypes = []schema.CommandType{schema.ExecCommandType} @@ -179,12 +171,65 @@ func Test_StarterProjects(t *testing.T) { libraryUtils.RunMultiThreadTest(testContent, t) } +func Test_Events(t *testing.T) { + testContent := commonUtils.TestContent{} + testContent.AddEvents = true + testContent.EditContent = false + testContent.FileName = commonUtils.GetDevFileName() + libraryUtils.RunTest(testContent, t) + libraryUtils.RunMultiThreadTest(testContent, t) +} + +func Test_EventsEdit(t *testing.T) { + testContent := commonUtils.TestContent{} + testContent.AddEvents = true + testContent.EditContent = true + testContent.FileName = commonUtils.GetDevFileName() + libraryUtils.RunTest(testContent, t) + libraryUtils.RunMultiThreadTest(testContent, t) +} + +func Test_Metadata(t *testing.T) { + testContent := commonUtils.TestContent{} + testContent.AddMetaData = true + testContent.EditContent = false + testContent.FileName = commonUtils.GetDevFileName() + libraryUtils.RunTest(testContent, t) + libraryUtils.RunMultiThreadTest(testContent, t) +} + +func Test_MetadataEdit(t *testing.T) { + testContent := commonUtils.TestContent{} + testContent.AddMetaData = true + testContent.EditContent = true + testContent.FileName = commonUtils.GetDevFileName() + libraryUtils.RunTest(testContent, t) + libraryUtils.RunMultiThreadTest(testContent, t) +} + func Test_Everything(t *testing.T) { testContent := commonUtils.TestContent{} testContent.CommandTypes = []schema.CommandType{schema.ExecCommandType, schema.CompositeCommandType, schema.ApplyCommandType} - testContent.ComponentTypes = []schema.ComponentType{schema.ContainerComponentType, schema.VolumeComponentType} + testContent.ComponentTypes = []schema.ComponentType{schema.ContainerComponentType, schema.KubernetesComponentType, schema.OpenshiftComponentType, schema.VolumeComponentType} + testContent.ProjectTypes = []schema.ProjectSourceType{schema.GitProjectSourceType, schema.ZipProjectSourceType} + testContent.StarterProjectTypes = []schema.ProjectSourceType{schema.GitProjectSourceType, schema.ZipProjectSourceType} + testContent.AddEvents = true + testContent.AddMetaData = true + testContent.EditContent = false + testContent.FileName = commonUtils.GetDevFileName() + libraryUtils.RunTest(testContent, t) + libraryUtils.RunMultiThreadTest(testContent, t) + +} + +func Test_EverythingEdit(t *testing.T) { + testContent := commonUtils.TestContent{} + testContent.CommandTypes = []schema.CommandType{schema.ExecCommandType, schema.CompositeCommandType, schema.ApplyCommandType} + testContent.ComponentTypes = []schema.ComponentType{schema.ContainerComponentType, schema.KubernetesComponentType, schema.OpenshiftComponentType, schema.VolumeComponentType} testContent.ProjectTypes = []schema.ProjectSourceType{schema.GitProjectSourceType, schema.ZipProjectSourceType} testContent.StarterProjectTypes = []schema.ProjectSourceType{schema.GitProjectSourceType, schema.ZipProjectSourceType} + testContent.AddEvents = true + testContent.AddMetaData = true testContent.EditContent = true testContent.FileName = commonUtils.GetDevFileName() libraryUtils.RunTest(testContent, t) diff --git a/tests/v2/utils/library/test_utils.go b/tests/v2/utils/library/test_utils.go index fd803035..57e8d28b 100644 --- a/tests/v2/utils/library/test_utils.go +++ b/tests/v2/utils/library/test_utils.go @@ -106,7 +106,7 @@ func (devfileFollower DevfileFollower) AddEvent(event schema.Events) error { // UpdateEvent updates the specified event in the library data func (devfileFollower DevfileFollower) UpdateEvent(event schema.Events) { - devfileFollower.LibraryData.UpdateEvents(event.PreStart, event.PostStart, event.PreStop, event.PostStop) + devfileFollower.LibraryData.UpdateEvents(event.PostStart, event.PostStop, event.PreStart, event.PreStop) } // SetParent sets the specified parent in the library data