forked from devfile/library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibrary_test.go
193 lines (171 loc) · 7.29 KB
/
library_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
package api
import (
"testing"
schema "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
commonUtils "github.com/devfile/api/v2/test/v200/utils/common"
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}
testContent.EditContent = false
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_ExecCommandEdit(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.CommandTypes = []schema.CommandType{schema.ExecCommandType}
testContent.EditContent = true
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_ApplyCommand(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.CommandTypes = []schema.CommandType{schema.ApplyCommandType}
testContent.EditContent = false
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_ApplyCommandEdit(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.CommandTypes = []schema.CommandType{schema.ApplyCommandType}
testContent.EditContent = true
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_CompositeCommand(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.CommandTypes = []schema.CommandType{schema.CompositeCommandType}
testContent.EditContent = false
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_CompositeCommandEdit(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.CommandTypes = []schema.CommandType{schema.CompositeCommandType}
testContent.EditContent = true
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_MultiCommand(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.CommandTypes = []schema.CommandType{schema.ExecCommandType,
schema.CompositeCommandType,
schema.ApplyCommandType}
testContent.EditContent = true
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_ContainerComponent(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.ComponentTypes = []schema.ComponentType{schema.ContainerComponentType}
testContent.EditContent = false
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_ContainerComponentEdit(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.ComponentTypes = []schema.ComponentType{schema.ContainerComponentType}
testContent.EditContent = true
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, 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}
testContent.EditContent = false
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_VolumeComponentEdit(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.ComponentTypes = []schema.ComponentType{schema.VolumeComponentType}
testContent.EditContent = true
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_MultiComponent(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.ComponentTypes = []schema.ComponentType{schema.ContainerComponentType, schema.VolumeComponentType}
testContent.EditContent = true
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_Projects(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.ProjectTypes = []schema.ProjectSourceType{schema.GitProjectSourceType, schema.ZipProjectSourceType}
testContent.EditContent = true
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}
func Test_StarterProjects(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.StarterProjectTypes = []schema.ProjectSourceType{schema.GitProjectSourceType, schema.ZipProjectSourceType}
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.ProjectTypes = []schema.ProjectSourceType{schema.GitProjectSourceType, schema.ZipProjectSourceType}
testContent.StarterProjectTypes = []schema.ProjectSourceType{schema.GitProjectSourceType, schema.ZipProjectSourceType}
testContent.EditContent = true
testContent.FileName = commonUtils.GetDevFileName()
libraryUtils.RunTest(testContent, t)
libraryUtils.RunMultiThreadTest(testContent, t)
}