mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* update vendor directory, add go.opencensus.io * update imports * oops * s/opentracing/opencensus/ & remove prometheus / zipkin stuff & remove old stats * the dep train rides again * fix gin build * deps from last guy * start in on the agent metrics * she builds * remove tags for now, cardinality error is fussing. subscribe instead of register * update to patched version of opencensus to proceed for now TODO switch to a release * meh fix imports * println debug the bad boys * lace it with the tags * update deps again * fix all inconsistent cardinality errors * add our own logger * fix init * fix oom measure * remove bugged removal code * fix s3 measures * fix prom handler nil
59 lines
1.2 KiB
Go
59 lines
1.2 KiB
Go
package s3
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
"github.com/aws/aws-sdk-go/awstesting/unit"
|
|
)
|
|
|
|
func BenchmarkPresign_GetObject(b *testing.B) {
|
|
sess := unit.Session
|
|
svc := New(sess)
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
req, _ := svc.GetObjectRequest(&GetObjectInput{
|
|
Bucket: aws.String("mock-bucket"),
|
|
Key: aws.String("mock-key"),
|
|
})
|
|
|
|
u, h, err := req.PresignRequest(15 * time.Minute)
|
|
if err != nil {
|
|
b.Fatalf("expect no error, got %v", err)
|
|
}
|
|
if len(u) == 0 {
|
|
b.Fatalf("expect url, got none")
|
|
}
|
|
if len(h) != 0 {
|
|
b.Fatalf("no signed headers, got %v", h)
|
|
}
|
|
}
|
|
}
|
|
|
|
func BenchmarkPresign_PutObject(b *testing.B) {
|
|
sess := unit.Session
|
|
svc := New(sess)
|
|
|
|
body := make([]byte, 1024*1024*20)
|
|
for i := 0; i < b.N; i++ {
|
|
req, _ := svc.PutObjectRequest(&PutObjectInput{
|
|
Bucket: aws.String("mock-bucket"),
|
|
Key: aws.String("mock-key"),
|
|
Body: bytes.NewReader(body),
|
|
})
|
|
|
|
u, h, err := req.PresignRequest(15 * time.Minute)
|
|
if err != nil {
|
|
b.Fatalf("expect no error, got %v", err)
|
|
}
|
|
if len(u) == 0 {
|
|
b.Fatalf("expect url, got none")
|
|
}
|
|
if len(h) == 0 {
|
|
b.Fatalf("expect signed header, got none")
|
|
}
|
|
}
|
|
}
|