@@ -41,6 +41,7 @@ import (
41
41
"github.com/fluxcd/pkg/sourceignore"
42
42
43
43
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
44
+ pkgtesting "github.com/fluxcd/source-controller/pkg/testing"
44
45
)
45
46
46
47
const (
@@ -162,7 +163,7 @@ func TestMain(m *testing.M) {
162
163
testMinioAddress = fmt .Sprintf ("127.0.0.1:%v" , resource .GetPort ("9000/tcp" ))
163
164
164
165
// Construct a Minio client using the address of the Minio server.
165
- testMinioClient , err = NewClient (bucketStub (bucket , testMinioAddress ), secret .DeepCopy (), testTLSConfig )
166
+ testMinioClient , err = NewClient (bucketStub (bucket , testMinioAddress ), secret .DeepCopy (), testTLSConfig , nil )
166
167
if err != nil {
167
168
log .Fatalf ("cannot create Minio client: %s" , err )
168
169
}
@@ -195,19 +196,19 @@ func TestMain(m *testing.M) {
195
196
}
196
197
197
198
func TestNewClient (t * testing.T ) {
198
- minioClient , err := NewClient (bucketStub (bucket , testMinioAddress ), secret .DeepCopy (), testTLSConfig )
199
+ minioClient , err := NewClient (bucketStub (bucket , testMinioAddress ), secret .DeepCopy (), testTLSConfig , nil )
199
200
assert .NilError (t , err )
200
201
assert .Assert (t , minioClient != nil )
201
202
}
202
203
203
204
func TestNewClientEmptySecret (t * testing.T ) {
204
- minioClient , err := NewClient (bucketStub (bucket , testMinioAddress ), emptySecret .DeepCopy (), testTLSConfig )
205
+ minioClient , err := NewClient (bucketStub (bucket , testMinioAddress ), emptySecret .DeepCopy (), testTLSConfig , nil )
205
206
assert .NilError (t , err )
206
207
assert .Assert (t , minioClient != nil )
207
208
}
208
209
209
210
func TestNewClientAwsProvider (t * testing.T ) {
210
- minioClient , err := NewClient (bucketStub (bucketAwsProvider , testMinioAddress ), nil , nil )
211
+ minioClient , err := NewClient (bucketStub (bucketAwsProvider , testMinioAddress ), nil , nil , nil )
211
212
assert .NilError (t , err )
212
213
assert .Assert (t , minioClient != nil )
213
214
}
@@ -234,6 +235,19 @@ func TestFGetObject(t *testing.T) {
234
235
assert .NilError (t , err )
235
236
}
236
237
238
+ func TestNewClientAndFGetObjectWithProxy (t * testing.T ) {
239
+ proxyURL , closeProxy := pkgtesting .NewHTTPProxy (t )
240
+ defer closeProxy ()
241
+ minioClient , err := NewClient (bucketStub (bucket , testMinioAddress ), secret .DeepCopy (), testTLSConfig , proxyURL )
242
+ assert .NilError (t , err )
243
+ assert .Assert (t , minioClient != nil )
244
+ ctx := context .Background ()
245
+ tempDir := t .TempDir ()
246
+ path := filepath .Join (tempDir , sourceignore .IgnoreFile )
247
+ _ , err = minioClient .FGetObject (ctx , bucketName , objectName , path )
248
+ assert .NilError (t , err )
249
+ }
250
+
237
251
func TestFGetObjectNotExists (t * testing.T ) {
238
252
ctx := context .Background ()
239
253
tempDir := t .TempDir ()
0 commit comments