mirror of
https://github.com/nabbar/golib.git
synced 2025-10-30 02:31:57 +08:00
Bump to sdk aws go v2 at release v0.26.0...
Bump dependancies Refactor / Fix aws to work with sdk-aws-go-v2 at release v0.26.0...
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package aws_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -15,6 +18,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/nabbar/golib/httpcli"
|
||||
|
||||
"github.com/hashicorp/go-uuid"
|
||||
"github.com/nabbar/golib/aws"
|
||||
"github.com/nabbar/golib/aws/configCustom"
|
||||
@@ -46,6 +51,7 @@ var _ = BeforeSuite(func() {
|
||||
var (
|
||||
err error
|
||||
name string
|
||||
htp *http.Client
|
||||
)
|
||||
|
||||
ctx, cnl = context.WithCancel(context.Background())
|
||||
@@ -61,7 +67,11 @@ var _ = BeforeSuite(func() {
|
||||
secretKey = password.Generate(64)
|
||||
)
|
||||
|
||||
htp = httpcli.GetClient(uri.Hostname())
|
||||
Expect(htp).NotTo(BeNil())
|
||||
|
||||
cfg = configCustom.NewConfig("", accessKey, secretKey, uri, "us-east-1")
|
||||
Expect(cfg).NotTo(BeNil())
|
||||
|
||||
cfg.SetRegion("us-east-1")
|
||||
err = cfg.RegisterRegionAws(nil)
|
||||
@@ -75,10 +85,11 @@ var _ = BeforeSuite(func() {
|
||||
time.Sleep(10 * time.Second)
|
||||
}
|
||||
|
||||
time.Sleep(10 * time.Second)
|
||||
println("Minio is waiting on : " + uri.Host)
|
||||
}
|
||||
|
||||
cli, err = aws.New(ctx, cfg, nil)
|
||||
cli, err = aws.New(ctx, cfg, htp)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(cli).NotTo(BeNil())
|
||||
|
||||
@@ -201,3 +212,15 @@ func WaitMinio(host string) bool {
|
||||
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func randContent(size int) *bytes.Buffer {
|
||||
p := make([]byte, size)
|
||||
|
||||
_, err := rand.Read(p)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return bytes.NewBuffer(p)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user