Skip to content

Commit

Permalink
Update perf tests for package refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jasdel committed Aug 20, 2015
1 parent 1fd4c57 commit 848b7c7
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 35 deletions.
1 change: 0 additions & 1 deletion internal/test/perf/dynamodb/dynamodb_live_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ func benchPutItemParallel(p, c int, b *testing.B) {
}
})
}

9 changes: 5 additions & 4 deletions internal/test/perf/dynamodb/dynamodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
package dynamodb

import (
"io"
"net/http"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
"io"
"net/http"
)

type noopReadCloser struct{}
Expand All @@ -27,6 +27,7 @@ var noopBody = &noopReadCloser{}

func BenchmarkPutItem(b *testing.B) {
cfg := aws.Config{
Region: aws.String("us-east-1"),
DisableSSL: aws.Bool(true),
Credentials: credentials.NewStaticCredentials("AKID", "SECRET", ""),
}
Expand All @@ -35,7 +36,7 @@ func BenchmarkPutItem(b *testing.B) {

svc := dynamodb.New(&cfg)
svc.Handlers.Send.Clear()
svc.Handlers.Send.PushBack(func(r *service.Request) {
svc.Handlers.Send.PushBack(func(r *request.Request) {
r.HTTPResponse = &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Expand Down
2 changes: 1 addition & 1 deletion internal/test/perf/dynamodb/stub.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dynamodb

import (
"net/http/httptest"
"net/http"
"net/http/httptest"
)

type dbItem struct {
Expand Down
5 changes: 3 additions & 2 deletions internal/test/perf/protocol/ec2query_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/ec2query"
"github.com/aws/aws-sdk-go/service/ec2"
Expand Down Expand Up @@ -66,12 +67,12 @@ func BenchmarkEC2QueryBuild_Simple_ec2AttachNetworkInterface(b *testing.B) {
}

func benchEC2QueryBuild(b *testing.B, opName string, params interface{}) {
svc := service.NewService(nil)
svc := service.New(nil)
svc.ServiceName = "ec2"
svc.APIVersion = "2015-04-15"

for i := 0; i < b.N; i++ {
r := service.NewRequest(svc, &service.Operation{
r := svc.NewRequest(&request.Operation{
Name: opName,
HTTPMethod: "POST",
HTTPPath: "/",
Expand Down
17 changes: 9 additions & 8 deletions internal/test/perf/protocol/jsonrpc_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@
package protocol

import (
"bytes"
"encoding/json"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/jsonrpc"
"github.com/aws/aws-sdk-go/internal/protocol/json/jsonutil"
"github.com/aws/aws-sdk-go/internal/protocol/jsonrpc"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
"encoding/json"
"bytes"
)

func BenchmarkJSONRPCBuild_Simple_dynamodbPutItem(b *testing.B) {
svc := service.NewService(nil)
svc := service.New(nil)

params := getDynamodbPutItemParams(b)

for i := 0; i < b.N; i++ {
r := service.NewRequest(svc, &service.Operation{Name: "Operation"}, params, nil)
r := svc.NewRequest(&request.Operation{Name: "Operation"}, params, nil)
jsonrpc.Build(r)
if r.Error != nil {
b.Fatal("Unexpected error", r.Error)
Expand All @@ -30,12 +31,12 @@ func BenchmarkJSONRPCBuild_Simple_dynamodbPutItem(b *testing.B) {
}

func BenchmarkJSONUtilBuild_Simple_dynamodbPutItem(b *testing.B) {
svc := service.NewService(nil)
svc := service.New(nil)

params := getDynamodbPutItemParams(b)

for i := 0; i < b.N; i++ {
r := service.NewRequest(svc, &service.Operation{Name: "Operation"}, params, nil)
r := svc.NewRequest(&request.Operation{Name: "Operation"}, params, nil)
_, err := jsonutil.BuildJSON(r.Params)
if err != nil {
b.Fatal("Unexpected error", err)
Expand Down Expand Up @@ -67,4 +68,4 @@ func getDynamodbPutItemParams(b *testing.B) *dynamodb.PutItemInput {
Item: av,
TableName: aws.String("tablename"),
}
}
}
22 changes: 11 additions & 11 deletions internal/test/perf/protocol/restjson_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@
package protocol

import (
"bytes"
"encoding/json"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/rest"
"github.com/aws/aws-sdk-go/internal/protocol/restjson"
"github.com/aws/aws-sdk-go/service/elastictranscoder"
"bytes"
"encoding/json"
)

func BenchmarkRESTJSONBuild_Complex_elastictranscoderCreateJobInput(b *testing.B) {
svc := service.NewService(nil)
svc := service.New(nil)
svc.ServiceName = "elastictranscoder"
svc.APIVersion = "2012-09-25"

for i := 0; i < b.N; i++ {
r := service.NewRequest(svc, &service.Operation{Name: "CreateJobInput"}, restjsonBuildParms, nil)
r := svc.NewRequest(&request.Operation{Name: "CreateJobInput"}, restjsonBuildParms, nil)
restjson.Build(r)
if r.Error != nil {
b.Fatal("Unexpected error", r.Error)
Expand All @@ -29,12 +30,12 @@ func BenchmarkRESTJSONBuild_Complex_elastictranscoderCreateJobInput(b *testing.B
}

func BenchmarkRESTBuild_Complex_elastictranscoderCreateJobInput(b *testing.B) {
svc := service.NewService(nil)
svc := service.New(nil)
svc.ServiceName = "elastictranscoder"
svc.APIVersion = "2012-09-25"

for i := 0; i < b.N; i++ {
r := service.NewRequest(svc, &service.Operation{Name: "CreateJobInput"}, restjsonBuildParms, nil)
r := svc.NewRequest(&request.Operation{Name: "CreateJobInput"}, restjsonBuildParms, nil)
rest.Build(r)
if r.Error != nil {
b.Fatal("Unexpected error", r.Error)
Expand All @@ -55,7 +56,7 @@ func BenchmarkEncodingJSONMarshal_Complex_elastictranscoderCreateJobInput(b *tes
}

func BenchmarkRESTJSONBuild_Simple_elastictranscoderListJobsByPipeline(b *testing.B) {
svc := service.NewService(nil)
svc := service.New(nil)
svc.ServiceName = "elastictranscoder"
svc.APIVersion = "2012-09-25"

Expand All @@ -66,7 +67,7 @@ func BenchmarkRESTJSONBuild_Simple_elastictranscoderListJobsByPipeline(b *testin
}

for i := 0; i < b.N; i++ {
r := service.NewRequest(svc, &service.Operation{Name: "ListJobsByPipeline"}, params, nil)
r := svc.NewRequest(&request.Operation{Name: "ListJobsByPipeline"}, params, nil)
restjson.Build(r)
if r.Error != nil {
b.Fatal("Unexpected error", r.Error)
Expand All @@ -75,7 +76,7 @@ func BenchmarkRESTJSONBuild_Simple_elastictranscoderListJobsByPipeline(b *testin
}

func BenchmarkRESTBuild_Simple_elastictranscoderListJobsByPipeline(b *testing.B) {
svc := service.NewService(nil)
svc := service.New(nil)
svc.ServiceName = "elastictranscoder"
svc.APIVersion = "2012-09-25"

Expand All @@ -86,15 +87,14 @@ func BenchmarkRESTBuild_Simple_elastictranscoderListJobsByPipeline(b *testing.B)
}

for i := 0; i < b.N; i++ {
r := service.NewRequest(svc, &service.Operation{Name: "ListJobsByPipeline"}, params, nil)
r := svc.NewRequest(&request.Operation{Name: "ListJobsByPipeline"}, params, nil)
rest.Build(r)
if r.Error != nil {
b.Fatal("Unexpected error", r.Error)
}
}
}


func BenchmarkEncodingJSONMarshal_Simple_elastictranscoderListJobsByPipeline(b *testing.B) {
params := &elastictranscoder.ListJobsByPipelineInput{
PipelineId: aws.String("Id"), // Required
Expand Down
15 changes: 8 additions & 7 deletions internal/test/perf/protocol/restxml_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ package protocol
import (
"testing"

"bytes"
"encoding/xml"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/restxml"
"github.com/aws/aws-sdk-go/service/cloudfront"
"bytes"
"encoding/xml"
)

func BenchmarkRESTXMLBuild_Complex_cloudfrontCreateDistribution(b *testing.B) {
params := restxmlBuildCreateDistroParms

op := &service.Operation{
op := &request.Operation{
Name: "CreateDistribution",
HTTPMethod: "POST",
HTTPPath: "/2015-04-17/distribution/{DistributionId}/invalidation",
Expand All @@ -30,7 +31,7 @@ func BenchmarkRESTXMLBuild_Simple_cloudfrontDeleteStreamingDistribution(b *testi
Id: aws.String("string"), // Required
IfMatch: aws.String("string"),
}
op := &service.Operation{
op := &request.Operation{
Name: "DeleteStreamingDistribution",
HTTPMethod: "DELETE",
HTTPPath: "/2015-04-17/streaming-distribution/{Id}",
Expand All @@ -53,13 +54,13 @@ func BenchmarkEncodingXMLMarshal_Simple_cloudfrontDeleteStreamingDistribution(b
}
}

func benchRESTXMLBuild(b *testing.B, op *service.Operation, params interface{}) {
svc := service.NewService(nil)
func benchRESTXMLBuild(b *testing.B, op *request.Operation, params interface{}) {
svc := service.New(nil)
svc.ServiceName = "cloudfront"
svc.APIVersion = "2015-04-17"

for i := 0; i < b.N; i++ {
r := service.NewRequest(svc, op, params, nil)
r := svc.NewRequest(op, params, nil)
restxml.Build(r)
if r.Error != nil {
b.Fatal("Unexpected error", r.Error)
Expand Down
1 change: 0 additions & 1 deletion internal/test/perf/s3/s3manager/stub.go

This file was deleted.

0 comments on commit 848b7c7

Please sign in to comment.