Skip to content

Commit e1621ce

Browse files
committed
Update dw merging tests for main branch dw rename
Signed-off-by: Maysun J Faisal <[email protected]>
1 parent 4e12491 commit e1621ce

File tree

1 file changed

+65
-65
lines changed

1 file changed

+65
-65
lines changed

Diff for: pkg/utils/overriding/merging_test.go

+65-65
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"path/filepath"
77
"testing"
88

9-
workspaces "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
9+
dw "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
1010
attributesPkg "github.com/devfile/api/v2/pkg/attributes"
1111
"github.com/stretchr/testify/assert"
1212
"k8s.io/apimachinery/pkg/util/json"
@@ -18,135 +18,135 @@ func TestBasicMerging(t *testing.T) {
1818

1919
tests := []struct {
2020
name string
21-
mainContent *workspaces.DevWorkspaceTemplateSpecContent
22-
parentFlattenedContent *workspaces.DevWorkspaceTemplateSpecContent
23-
pluginFlattenedContents []*workspaces.DevWorkspaceTemplateSpecContent
24-
expected *workspaces.DevWorkspaceTemplateSpecContent
21+
mainContent *dw.DevWorkspaceTemplateSpecContent
22+
parentFlattenedContent *dw.DevWorkspaceTemplateSpecContent
23+
pluginFlattenedContents []*dw.DevWorkspaceTemplateSpecContent
24+
expected *dw.DevWorkspaceTemplateSpecContent
2525
wantErr *string
2626
}{
2727
{
2828
name: "Basic Merging",
29-
mainContent: &workspaces.DevWorkspaceTemplateSpecContent{
29+
mainContent: &dw.DevWorkspaceTemplateSpecContent{
3030
Variables: map[string]string{
3131
"version1": "main",
3232
},
3333
Attributes: attributesPkg.Attributes{}.FromMap(map[string]interface{}{
3434
"main": true,
3535
}, nil),
36-
Commands: []workspaces.Command{
36+
Commands: []dw.Command{
3737
{
3838
Id: "mainCommand",
39-
CommandUnion: workspaces.CommandUnion{
40-
Exec: &workspaces.ExecCommand{
39+
CommandUnion: dw.CommandUnion{
40+
Exec: &dw.ExecCommand{
4141
WorkingDir: "dir",
4242
},
4343
},
4444
},
4545
},
46-
Components: []workspaces.Component{
46+
Components: []dw.Component{
4747
{
4848
Name: "mainComponent",
49-
ComponentUnion: workspaces.ComponentUnion{
50-
Container: &workspaces.ContainerComponent{
51-
Container: workspaces.Container{
49+
ComponentUnion: dw.ComponentUnion{
50+
Container: &dw.ContainerComponent{
51+
Container: dw.Container{
5252
Image: "image",
5353
},
5454
},
5555
},
5656
},
5757
{
5858
Name: "mainPluginComponent",
59-
ComponentUnion: workspaces.ComponentUnion{
60-
Plugin: &workspaces.PluginComponent{
61-
ImportReference: workspaces.ImportReference{
62-
ImportReferenceUnion: workspaces.ImportReferenceUnion{
59+
ComponentUnion: dw.ComponentUnion{
60+
Plugin: &dw.PluginComponent{
61+
ImportReference: dw.ImportReference{
62+
ImportReferenceUnion: dw.ImportReferenceUnion{
6363
Uri: "uri",
6464
},
6565
},
6666
},
6767
},
6868
},
6969
},
70-
Events: &workspaces.Events{
71-
WorkspaceEvents: workspaces.WorkspaceEvents{
70+
Events: &dw.Events{
71+
DevWorkspaceEvents: dw.DevWorkspaceEvents{
7272
PostStop: []string{"post-stop-main"},
7373
},
7474
},
7575
},
76-
pluginFlattenedContents: []*workspaces.DevWorkspaceTemplateSpecContent{
76+
pluginFlattenedContents: []*dw.DevWorkspaceTemplateSpecContent{
7777
{
7878
Variables: map[string]string{
7979
"version2": "plugin",
8080
},
8181
Attributes: attributesPkg.Attributes{}.FromMap(map[string]interface{}{
8282
"plugin": true,
8383
}, nil),
84-
Commands: []workspaces.Command{
84+
Commands: []dw.Command{
8585
{
8686
Id: "pluginCommand",
87-
CommandUnion: workspaces.CommandUnion{
88-
Exec: &workspaces.ExecCommand{
87+
CommandUnion: dw.CommandUnion{
88+
Exec: &dw.ExecCommand{
8989
WorkingDir: "dir",
9090
},
9191
},
9292
},
9393
},
94-
Components: []workspaces.Component{
94+
Components: []dw.Component{
9595
{
9696
Name: "pluginComponent",
97-
ComponentUnion: workspaces.ComponentUnion{
98-
Container: &workspaces.ContainerComponent{
99-
Container: workspaces.Container{
97+
ComponentUnion: dw.ComponentUnion{
98+
Container: &dw.ContainerComponent{
99+
Container: dw.Container{
100100
Image: "image",
101101
},
102102
},
103103
},
104104
},
105105
},
106-
Events: &workspaces.Events{
107-
WorkspaceEvents: workspaces.WorkspaceEvents{
106+
Events: &dw.Events{
107+
DevWorkspaceEvents: dw.DevWorkspaceEvents{
108108
PostStop: []string{"post-stop-plugin"},
109109
},
110110
},
111111
},
112112
},
113-
parentFlattenedContent: &workspaces.DevWorkspaceTemplateSpecContent{
113+
parentFlattenedContent: &dw.DevWorkspaceTemplateSpecContent{
114114
Variables: map[string]string{
115115
"version3": "parent",
116116
},
117117
Attributes: attributesPkg.Attributes{}.FromMap(map[string]interface{}{
118118
"parent": true,
119119
}, nil),
120-
Commands: []workspaces.Command{
120+
Commands: []dw.Command{
121121
{
122122
Id: "parentCommand",
123-
CommandUnion: workspaces.CommandUnion{
124-
Exec: &workspaces.ExecCommand{
123+
CommandUnion: dw.CommandUnion{
124+
Exec: &dw.ExecCommand{
125125
WorkingDir: "dir",
126126
},
127127
},
128128
},
129129
},
130-
Components: []workspaces.Component{
130+
Components: []dw.Component{
131131
{
132132
Name: "parentComponent",
133-
ComponentUnion: workspaces.ComponentUnion{
134-
Container: &workspaces.ContainerComponent{
135-
Container: workspaces.Container{
133+
ComponentUnion: dw.ComponentUnion{
134+
Container: &dw.ContainerComponent{
135+
Container: dw.Container{
136136
Image: "image",
137137
},
138138
},
139139
},
140140
},
141141
},
142-
Events: &workspaces.Events{
143-
WorkspaceEvents: workspaces.WorkspaceEvents{
142+
Events: &dw.Events{
143+
DevWorkspaceEvents: dw.DevWorkspaceEvents{
144144
PostStop: []string{"post-stop-parent"},
145145
PostStart: []string{"post-start-parent"},
146146
},
147147
},
148148
},
149-
expected: &workspaces.DevWorkspaceTemplateSpecContent{
149+
expected: &dw.DevWorkspaceTemplateSpecContent{
150150
Variables: map[string]string{
151151
"version3": "parent",
152152
"version2": "plugin",
@@ -157,66 +157,66 @@ func TestBasicMerging(t *testing.T) {
157157
"plugin": true,
158158
"main": true,
159159
}, nil),
160-
Commands: []workspaces.Command{
160+
Commands: []dw.Command{
161161
{
162162
Id: "parentCommand",
163-
CommandUnion: workspaces.CommandUnion{
164-
Exec: &workspaces.ExecCommand{
163+
CommandUnion: dw.CommandUnion{
164+
Exec: &dw.ExecCommand{
165165
WorkingDir: "dir",
166166
},
167167
},
168168
},
169169
{
170170
Id: "pluginCommand",
171-
CommandUnion: workspaces.CommandUnion{
172-
Exec: &workspaces.ExecCommand{
171+
CommandUnion: dw.CommandUnion{
172+
Exec: &dw.ExecCommand{
173173
WorkingDir: "dir",
174174
},
175175
},
176176
},
177177
{
178178
Id: "mainCommand",
179-
CommandUnion: workspaces.CommandUnion{
180-
Exec: &workspaces.ExecCommand{
179+
CommandUnion: dw.CommandUnion{
180+
Exec: &dw.ExecCommand{
181181
WorkingDir: "dir",
182182
},
183183
},
184184
},
185185
},
186-
Components: []workspaces.Component{
186+
Components: []dw.Component{
187187
{
188188
Name: "parentComponent",
189-
ComponentUnion: workspaces.ComponentUnion{
190-
Container: &workspaces.ContainerComponent{
191-
Container: workspaces.Container{
189+
ComponentUnion: dw.ComponentUnion{
190+
Container: &dw.ContainerComponent{
191+
Container: dw.Container{
192192
Image: "image",
193193
},
194194
},
195195
},
196196
},
197197
{
198198
Name: "pluginComponent",
199-
ComponentUnion: workspaces.ComponentUnion{
200-
Container: &workspaces.ContainerComponent{
201-
Container: workspaces.Container{
199+
ComponentUnion: dw.ComponentUnion{
200+
Container: &dw.ContainerComponent{
201+
Container: dw.Container{
202202
Image: "image",
203203
},
204204
},
205205
},
206206
},
207207
{
208208
Name: "mainComponent",
209-
ComponentUnion: workspaces.ComponentUnion{
210-
Container: &workspaces.ContainerComponent{
211-
Container: workspaces.Container{
209+
ComponentUnion: dw.ComponentUnion{
210+
Container: &dw.ContainerComponent{
211+
Container: dw.Container{
212212
Image: "image",
213213
},
214214
},
215215
},
216216
},
217217
},
218-
Events: &workspaces.Events{
219-
WorkspaceEvents: workspaces.WorkspaceEvents{
218+
Events: &dw.Events{
219+
DevWorkspaceEvents: dw.DevWorkspaceEvents{
220220
PreStart: []string{},
221221
PostStart: []string{"post-start-parent"},
222222
PreStop: []string{},
@@ -337,9 +337,9 @@ func TestMergingOnlyPlugins(t *testing.T) {
337337
pluginFile := "test-fixtures/merges/no-parent/plugin.yaml"
338338
resultFile := "test-fixtures/merges/no-parent/result.yaml"
339339

340-
baseDWT := workspaces.DevWorkspaceTemplateSpecContent{}
341-
pluginDWT := workspaces.DevWorkspaceTemplateSpecContent{}
342-
expectedDWT := workspaces.DevWorkspaceTemplateSpecContent{}
340+
baseDWT := dw.DevWorkspaceTemplateSpecContent{}
341+
pluginDWT := dw.DevWorkspaceTemplateSpecContent{}
342+
expectedDWT := dw.DevWorkspaceTemplateSpecContent{}
343343

344344
readFileToStruct(t, baseFile, &baseDWT)
345345
readFileToStruct(t, pluginFile, &pluginDWT)
@@ -357,9 +357,9 @@ func TestMergingOnlyParent(t *testing.T) {
357357
parentFile := "test-fixtures/merges/no-parent/plugin.yaml"
358358
resultFile := "test-fixtures/merges/no-parent/result.yaml"
359359

360-
baseDWT := workspaces.DevWorkspaceTemplateSpecContent{}
361-
parentDWT := workspaces.DevWorkspaceTemplateSpecContent{}
362-
expectedDWT := workspaces.DevWorkspaceTemplateSpecContent{}
360+
baseDWT := dw.DevWorkspaceTemplateSpecContent{}
361+
parentDWT := dw.DevWorkspaceTemplateSpecContent{}
362+
expectedDWT := dw.DevWorkspaceTemplateSpecContent{}
363363

364364
readFileToStruct(t, baseFile, &baseDWT)
365365
readFileToStruct(t, parentFile, &parentDWT)

0 commit comments

Comments
 (0)