@@ -39,14 +39,13 @@ import (
39
39
func NewMockDeployer () * MockDeployer { return & MockDeployer {labels : make (map [string ]string )} }
40
40
41
41
type MockDeployer struct {
42
- labels map [string ]string
43
- deployNamespaces []string
44
- deployErr error
45
- dependencies []string
46
- dependenciesErr error
47
- cleanupErr error
48
- renderResult string
49
- renderErr error
42
+ labels map [string ]string
43
+ deployErr error
44
+ dependencies []string
45
+ dependenciesErr error
46
+ cleanupErr error
47
+ renderResult string
48
+ renderErr error
50
49
}
51
50
52
51
func (m * MockDeployer ) GetAccessor () access.Accessor {
@@ -106,20 +105,15 @@ func (m *MockDeployer) WithRenderErr(err error) *MockDeployer {
106
105
return m
107
106
}
108
107
109
- func (m * MockDeployer ) Deploy (context.Context , io.Writer , []graph.Artifact ) ([] string , error ) {
110
- return m .deployNamespaces , m . deployErr
108
+ func (m * MockDeployer ) Deploy (context.Context , io.Writer , []graph.Artifact ) error {
109
+ return m .deployErr
111
110
}
112
111
113
112
func (m * MockDeployer ) Render (_ context.Context , w io.Writer , _ []graph.Artifact , _ bool , _ string ) error {
114
113
w .Write ([]byte (m .renderResult ))
115
114
return m .renderErr
116
115
}
117
116
118
- func (m * MockDeployer ) WithDeployNamespaces (namespaces []string ) * MockDeployer {
119
- m .deployNamespaces = namespaces
120
- return m
121
- }
122
-
123
117
func (m * MockDeployer ) WithDependencies (dependencies []string ) * MockDeployer {
124
118
m .dependencies = dependencies
125
119
return m
@@ -141,32 +135,14 @@ func TestDeployerMux_Deploy(t *testing.T) {
141
135
shouldErr bool
142
136
}{
143
137
{
144
- name : "disjoint namespaces are combined" ,
145
- namespaces1 : []string {"ns-a" },
146
- namespaces2 : []string {"ns-b" },
147
- expectedNs : []string {"ns-a" , "ns-b" },
148
- },
149
- {
150
- name : "repeated namespaces are not duplicated" ,
151
- namespaces1 : []string {"ns-a" , "ns-c" },
152
- namespaces2 : []string {"ns-b" , "ns-c" },
153
- expectedNs : []string {"ns-a" , "ns-b" , "ns-c" },
154
- },
155
- {
156
- name : "short-circuits when first call fails" ,
157
- namespaces1 : []string {"ns-a" },
158
- err1 : fmt .Errorf ("failed in first" ),
159
- namespaces2 : []string {"ns-b" },
160
- expectedNs : nil ,
161
- shouldErr : true ,
138
+ name : "short-circuits when first call fails" ,
139
+ err1 : fmt .Errorf ("failed in first" ),
140
+ shouldErr : true ,
162
141
},
163
142
{
164
- name : "when second call fails" ,
165
- namespaces1 : []string {"ns-a" },
166
- namespaces2 : []string {"ns-b" },
167
- err2 : fmt .Errorf ("failed in second" ),
168
- expectedNs : nil ,
169
- shouldErr : true ,
143
+ name : "when second call fails" ,
144
+ err2 : fmt .Errorf ("failed in second" ),
145
+ shouldErr : true ,
170
146
},
171
147
}
172
148
@@ -181,13 +157,13 @@ func TestDeployerMux_Deploy(t *testing.T) {
181
157
}}})
182
158
183
159
deployerMux := NewDeployerMux ([]Deployer {
184
- NewMockDeployer ().WithDeployNamespaces ( test . namespaces1 ). WithDeployErr (test .err1 ),
185
- NewMockDeployer ().WithDeployNamespaces ( test . namespaces2 ). WithDeployErr (test .err2 ),
160
+ NewMockDeployer ().WithDeployErr (test .err1 ),
161
+ NewMockDeployer ().WithDeployErr (test .err2 ),
186
162
}, false )
187
163
188
- namespaces , err := deployerMux .Deploy (context .Background (), nil , nil )
164
+ err := deployerMux .Deploy (context .Background (), nil , nil )
189
165
190
- testutil .CheckErrorAndDeepEqual (t , test .shouldErr , err , test . expectedNs , namespaces )
166
+ testutil .CheckError (t , test .shouldErr , err )
191
167
})
192
168
}
193
169
}
0 commit comments