@@ -118,67 +118,76 @@ func TestOCIChartRepository_Get(t *testing.T) {
118
118
testURL := "oci://localhost:5000/my_repo"
119
119
120
120
testCases := []struct {
121
- name string
122
- url string
123
- version string
124
- expected string
125
- expectedErr string
121
+ name string
122
+ registryClient RegistryClient
123
+ url string
124
+ version string
125
+ expected string
126
+ expectedErr string
126
127
}{
127
128
{
128
- name : "should return latest stable version" ,
129
- version : "" ,
130
- url : testURL ,
131
- expected : "1.0.0" ,
129
+ name : "should return latest stable version" ,
130
+ registryClient : registryClient ,
131
+ version : "" ,
132
+ url : testURL ,
133
+ expected : "1.0.0" ,
132
134
},
133
135
{
134
- name : "should return latest stable version (asterisk)" ,
135
- version : "*" ,
136
- url : testURL ,
137
- expected : "1.0.0" ,
136
+ name : "should return latest stable version (asterisk)" ,
137
+ registryClient : registryClient ,
138
+ version : "*" ,
139
+ url : testURL ,
140
+ expected : "1.0.0" ,
138
141
},
139
142
{
140
- name : "should return latest stable version (semver range)" ,
141
- version : ">=0.1.5" ,
142
- url : testURL ,
143
- expected : "1.0.0" ,
143
+ name : "should return latest stable version (semver range)" ,
144
+ registryClient : registryClient ,
145
+ version : ">=0.1.5" ,
146
+ url : testURL ,
147
+ expected : "1.0.0" ,
144
148
},
145
149
{
146
- name : "should return 0.2.0 (semver range)" ,
147
- version : "0.2.x" ,
148
- url : testURL ,
149
- expected : "0.2.0" ,
150
+ name : "should return 0.2.0 (semver range)" ,
151
+ registryClient : registryClient ,
152
+ version : "0.2.x" ,
153
+ url : testURL ,
154
+ expected : "0.2.0" ,
150
155
},
151
156
{
152
- name : "should return a perfect match" ,
153
- version : "0.1.0" ,
154
- url : testURL ,
155
- expected : "0.1.0" ,
157
+ name : "should return a perfect match" ,
158
+ registryClient : nil ,
159
+ version : "0.1.0" ,
160
+ url : testURL ,
161
+ expected : "0.1.0" ,
156
162
},
157
163
{
158
- name : "should return 0.10.0" ,
159
- version : "0.*" ,
160
- url : testURL ,
161
- expected : "0.10.0" ,
164
+ name : "should return 0.10.0" ,
165
+ registryClient : registryClient ,
166
+ version : "0.*" ,
167
+ url : testURL ,
168
+ expected : "0.10.0" ,
162
169
},
163
170
{
164
- name : "should an error for unfunfilled range" ,
165
- version : ">2.0.0" ,
166
- url : testURL ,
167
- expectedErr : "could not locate a version matching provided version string >2.0.0" ,
171
+ name : "should an error for unfunfilled range" ,
172
+ registryClient : registryClient ,
173
+ version : ">2.0.0" ,
174
+ url : testURL ,
175
+ expectedErr : "could not locate a version matching provided version string >2.0.0" ,
168
176
},
169
177
{
170
- name : "shouldn't error out with trailing slash" ,
171
- version : "" ,
172
- url : "oci://localhost:5000/my_repo/" ,
173
- expected : "1.0.0" ,
178
+ name : "shouldn't error out with trailing slash" ,
179
+ registryClient : registryClient ,
180
+ version : "" ,
181
+ url : "oci://localhost:5000/my_repo/" ,
182
+ expected : "1.0.0" ,
174
183
},
175
184
}
176
185
177
186
for _ , tc := range testCases {
178
187
179
188
t .Run (tc .name , func (t * testing.T ) {
180
189
g := NewWithT (t )
181
- r , err := NewOCIChartRepository (tc .url , WithOCIRegistryClient (registryClient ), WithOCIGetter (providers ))
190
+ r , err := NewOCIChartRepository (tc .url , WithOCIRegistryClient (tc . registryClient ), WithOCIGetter (providers ))
182
191
g .Expect (err ).ToNot (HaveOccurred ())
183
192
g .Expect (r ).ToNot (BeNil ())
184
193
0 commit comments