@@ -18,7 +18,7 @@ import (
1818 "github.com/operator-framework/operator-registry/alpha/declcfg"
1919
2020 ocv1 "github.com/operator-framework/operator-controller/api/v1"
21- catalogClient "github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/client"
21+ catalogclient "github.com/operator-framework/operator-controller/internal/operator-controller/catalogmetadata/client"
2222 mockcatalogclient "github.com/operator-framework/operator-controller/internal/testutil/mock/catalogclient"
2323 mockhttputil "github.com/operator-framework/operator-controller/internal/testutil/mock/httputil"
2424)
@@ -47,7 +47,7 @@ func TestClientGetPackage(t *testing.T) {
4747 name string
4848 catalog func () * ocv1.ClusterCatalog
4949 pkgName string
50- setupCache func (ctrl * gomock.Controller ) catalogClient .Cache
50+ setupCache func (ctrl * gomock.Controller ) catalogclient .Cache
5151 assert func (* testing.T , * declcfg.DeclarativeConfig , error )
5252 }
5353 for _ , tc := range []testCase {
@@ -63,7 +63,7 @@ func TestClientGetPackage(t *testing.T) {
6363 {
6464 name : "served, cache returns error" ,
6565 catalog : defaultCatalog ,
66- setupCache : func (ctrl * gomock.Controller ) catalogClient .Cache {
66+ setupCache : func (ctrl * gomock.Controller ) catalogclient .Cache {
6767 cache := mockcatalogclient .NewMockCache (ctrl )
6868 cache .EXPECT ().Get (gomock .Any (), gomock .Any ()).Return (nil , errors .New ("fetch error" ))
6969 return cache
@@ -75,7 +75,7 @@ func TestClientGetPackage(t *testing.T) {
7575 {
7676 name : "served, invalid package path" ,
7777 catalog : defaultCatalog ,
78- setupCache : func (ctrl * gomock.Controller ) catalogClient .Cache {
78+ setupCache : func (ctrl * gomock.Controller ) catalogclient .Cache {
7979 cache := mockcatalogclient .NewMockCache (ctrl )
8080 cache .EXPECT ().Get (gomock .Any (), gomock .Any ()).Return (testFS , nil )
8181 return cache
@@ -89,7 +89,7 @@ func TestClientGetPackage(t *testing.T) {
8989 name : "served, package missing" ,
9090 catalog : defaultCatalog ,
9191 pkgName : "pkg-missing" ,
92- setupCache : func (ctrl * gomock.Controller ) catalogClient .Cache {
92+ setupCache : func (ctrl * gomock.Controller ) catalogclient .Cache {
9393 cache := mockcatalogclient .NewMockCache (ctrl )
9494 cache .EXPECT ().Get (gomock .Any (), gomock .Any ()).Return (testFS , nil )
9595 return cache
@@ -103,7 +103,7 @@ func TestClientGetPackage(t *testing.T) {
103103 name : "served, invalid package present" ,
104104 catalog : defaultCatalog ,
105105 pkgName : "invalid-pkg-present" ,
106- setupCache : func (ctrl * gomock.Controller ) catalogClient .Cache {
106+ setupCache : func (ctrl * gomock.Controller ) catalogclient .Cache {
107107 cache := mockcatalogclient .NewMockCache (ctrl )
108108 cache .EXPECT ().Get (gomock .Any (), gomock .Any ()).Return (fstest.MapFS {
109109 "invalid-pkg-present/olm.package/invalid-pkg-present.json" : & fstest.MapFile {Data : []byte (`{"schema": "olm.package","name": 12345}` )},
@@ -119,7 +119,7 @@ func TestClientGetPackage(t *testing.T) {
119119 name : "served, package present" ,
120120 catalog : defaultCatalog ,
121121 pkgName : "pkg-present" ,
122- setupCache : func (ctrl * gomock.Controller ) catalogClient .Cache {
122+ setupCache : func (ctrl * gomock.Controller ) catalogclient .Cache {
123123 cache := mockcatalogclient .NewMockCache (ctrl )
124124 cache .EXPECT ().Get (gomock .Any (), gomock .Any ()).Return (testFS , nil )
125125 return cache
@@ -133,7 +133,7 @@ func TestClientGetPackage(t *testing.T) {
133133 name : "cache unpopulated" ,
134134 catalog : defaultCatalog ,
135135 pkgName : "pkg-present" ,
136- setupCache : func (ctrl * gomock.Controller ) catalogClient .Cache {
136+ setupCache : func (ctrl * gomock.Controller ) catalogclient .Cache {
137137 cache := mockcatalogclient .NewMockCache (ctrl )
138138 cache .EXPECT ().Get (gomock .Any (), gomock .Any ()).Return (nil , nil )
139139 return cache
@@ -147,13 +147,13 @@ func TestClientGetPackage(t *testing.T) {
147147 ctx := context .Background ()
148148 ctrl := gomock .NewController (t )
149149
150- var cache catalogClient .Cache
150+ var cache catalogclient .Cache
151151 if tc .setupCache != nil {
152152 cache = tc .setupCache (ctrl )
153153 }
154154
155155 mockTripper := mockhttputil .NewMockRoundTripper (ctrl )
156- c := catalogClient .New (cache , func () (* http.Client , error ) {
156+ c := catalogclient .New (cache , func () (* http.Client , error ) {
157157 return & http.Client {
158158 // This is to prevent actual network calls
159159 Transport : mockTripper ,
@@ -173,14 +173,14 @@ func TestClientPopulateCache(t *testing.T) {
173173 type testCase struct {
174174 name string
175175 catalog func () * ocv1.ClusterCatalog
176- setupMocks func (t * testing.T , ctrl * gomock.Controller ) (catalogClient .Cache , func () (* http.Client , error ))
176+ setupMocks func (t * testing.T , ctrl * gomock.Controller ) (catalogclient .Cache , func () (* http.Client , error ))
177177 assert func (t * testing.T , fs fs.FS , err error )
178178 }
179179 for _ , tt := range []testCase {
180180 {
181181 name : "cache unpopulated, successful http request" ,
182182 catalog : defaultCatalog ,
183- setupMocks : func (t * testing.T , ctrl * gomock.Controller ) (catalogClient .Cache , func () (* http.Client , error )) {
183+ setupMocks : func (t * testing.T , ctrl * gomock.Controller ) (catalogclient .Cache , func () (* http.Client , error )) {
184184 cache := mockcatalogclient .NewMockCache (ctrl )
185185 cache .EXPECT ().Put (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).DoAndReturn (
186186 func (catalogName , resolvedRef string , source io.Reader , errToCache error ) (fs.FS , error ) {
@@ -215,7 +215,7 @@ func TestClientPopulateCache(t *testing.T) {
215215 catalog : func () * ocv1.ClusterCatalog {
216216 return & ocv1.ClusterCatalog {ObjectMeta : metav1.ObjectMeta {Name : "catalog-1" }}
217217 },
218- setupMocks : func (t * testing.T , ctrl * gomock.Controller ) (catalogClient .Cache , func () (* http.Client , error )) {
218+ setupMocks : func (t * testing.T , ctrl * gomock.Controller ) (catalogclient .Cache , func () (* http.Client , error )) {
219219 cache := mockcatalogclient .NewMockCache (ctrl )
220220 return cache , nil
221221 },
@@ -227,7 +227,7 @@ func TestClientPopulateCache(t *testing.T) {
227227 {
228228 name : "cache unpopulated, error on getting a http client" ,
229229 catalog : defaultCatalog ,
230- setupMocks : func (t * testing.T , ctrl * gomock.Controller ) (catalogClient .Cache , func () (* http.Client , error )) {
230+ setupMocks : func (t * testing.T , ctrl * gomock.Controller ) (catalogclient .Cache , func () (* http.Client , error )) {
231231 cache := mockcatalogclient .NewMockCache (ctrl )
232232 cache .EXPECT ().Put (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).DoAndReturn (
233233 func (catalogName , resolvedRef string , source io.Reader , errToCache error ) (fs.FS , error ) {
@@ -250,7 +250,7 @@ func TestClientPopulateCache(t *testing.T) {
250250 {
251251 name : "cache unpopulated, error on http request" ,
252252 catalog : defaultCatalog ,
253- setupMocks : func (t * testing.T , ctrl * gomock.Controller ) (catalogClient .Cache , func () (* http.Client , error )) {
253+ setupMocks : func (t * testing.T , ctrl * gomock.Controller ) (catalogclient .Cache , func () (* http.Client , error )) {
254254 cache := mockcatalogclient .NewMockCache (ctrl )
255255 cache .EXPECT ().Put (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).DoAndReturn (
256256 func (catalogName , resolvedRef string , source io.Reader , errToCache error ) (fs.FS , error ) {
@@ -276,7 +276,7 @@ func TestClientPopulateCache(t *testing.T) {
276276 {
277277 name : "cache unpopulated, unexpected http status" ,
278278 catalog : defaultCatalog ,
279- setupMocks : func (t * testing.T , ctrl * gomock.Controller ) (catalogClient .Cache , func () (* http.Client , error )) {
279+ setupMocks : func (t * testing.T , ctrl * gomock.Controller ) (catalogclient .Cache , func () (* http.Client , error )) {
280280 cache := mockcatalogclient .NewMockCache (ctrl )
281281
282282 mockTripper := mockhttputil .NewMockRoundTripper (ctrl )
@@ -301,7 +301,7 @@ func TestClientPopulateCache(t *testing.T) {
301301 ctrl := gomock .NewController (t )
302302
303303 cache , httpClient := tt .setupMocks (t , ctrl )
304- c := catalogClient .New (cache , httpClient )
304+ c := catalogclient .New (cache , httpClient )
305305 fs , err := c .PopulateCache (ctx , tt .catalog ())
306306 tt .assert (t , fs , err )
307307 })
0 commit comments