Skip to content

Commit c557094

Browse files
committed
Update to aws-sdk-go-v2
1 parent 12ae95a commit c557094

File tree

6 files changed

+94
-44
lines changed

6 files changed

+94
-44
lines changed

cmd/cftest/main.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"context"
45
"fmt"
56
"os"
67
"strings"
@@ -27,6 +28,8 @@ func main() {
2728
pflag.Parse()
2829
args := pflag.Args()
2930

31+
ctx := context.Background()
32+
3033
if *credits {
3134
fmt.Println(licenses)
3235
os.Exit(0)
@@ -37,7 +40,7 @@ func main() {
3740
os.Exit(2)
3841
}
3942

40-
runner, err := parseFunc(args[0])
43+
runner, err := parseFunc(ctx, args[0])
4144

4245
if err != nil {
4346
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
@@ -61,7 +64,7 @@ func main() {
6164
fmtPath := fmt.Sprintf("%%-%ds ", maxPathLen)
6265

6366
for _, t := range tests {
64-
r, err := cftest.RunTest(runner, t)
67+
r, err := cftest.RunTest(ctx, runner, t)
6568
path := fmt.Sprintf(fmtPath, t.Filename)
6669
utilization := color.HiBlackString(fmt.Sprintf("(%d%%)", r.Utilization))
6770

@@ -92,11 +95,11 @@ func colorDiff(diff string) string {
9295
return strings.Join(lines, "\n")
9396
}
9497

95-
func parseFunc(name string) (cftest.Runner, error) {
98+
func parseFunc(ctx context.Context, name string) (cftest.Runner, error) {
9699
parts := strings.SplitN(name, ":", 2)
97100

98101
if len(parts) > 1 && (parts[1] == "DEVELOPMENT" || parts[1] == "LIVE") {
99-
return cftest.NewCloudFrontRunner(parts[0], parts[1])
102+
return cftest.NewCloudFrontRunner(ctx, parts[0], parts[1])
100103
}
101104

102105
return nil, fmt.Errorf("function not found")

go.mod

+14-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,27 @@ module github.com/paulhammond/cftest
33
go 1.22
44

55
require (
6-
github.com/aws/aws-sdk-go v1.39.1
6+
github.com/aws/aws-sdk-go-v2 v1.25.2
7+
github.com/aws/aws-sdk-go-v2/config v1.27.4
8+
github.com/aws/aws-sdk-go-v2/service/cloudfront v1.35.1
79
github.com/fatih/color v1.16.0
810
github.com/kylelemons/godebug v1.1.0
911
github.com/paulhammond/licensepack v0.0.0-20230830042735-3a27d821c8c0
1012
github.com/spf13/pflag v1.0.5
1113
)
1214

1315
require (
16+
github.com/aws/aws-sdk-go-v2/credentials v1.17.4 // indirect
17+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.2 // indirect
18+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.2 // indirect
19+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2 // indirect
20+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
21+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect
22+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.2 // indirect
23+
github.com/aws/aws-sdk-go-v2/service/sso v1.20.1 // indirect
24+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1 // indirect
25+
github.com/aws/aws-sdk-go-v2/service/sts v1.28.1 // indirect
26+
github.com/aws/smithy-go v1.20.1 // indirect
1427
github.com/jmespath/go-jmespath v0.4.0 // indirect
1528
github.com/mattn/go-colorable v0.1.13 // indirect
1629
github.com/mattn/go-isatty v0.0.20 // indirect

go.sum

+30-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,37 @@
1-
github.com/aws/aws-sdk-go v1.39.1 h1:z8Dlu6ZEPIveIh3D3JAbvWvoo2/Xvio3MbLKtIYOCbE=
2-
github.com/aws/aws-sdk-go v1.39.1/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q=
1+
github.com/aws/aws-sdk-go-v2 v1.25.2 h1:/uiG1avJRgLGiQM9X3qJM8+Qa6KRGK5rRPuXE0HUM+w=
2+
github.com/aws/aws-sdk-go-v2 v1.25.2/go.mod h1:Evoc5AsmtveRt1komDwIsjHFyrP5tDuF1D1U+6z6pNo=
3+
github.com/aws/aws-sdk-go-v2/config v1.27.4 h1:AhfWb5ZwimdsYTgP7Od8E9L1u4sKmDW2ZVeLcf2O42M=
4+
github.com/aws/aws-sdk-go-v2/config v1.27.4/go.mod h1:zq2FFXK3A416kiukwpsd+rD4ny6JC7QSkp4QdN1Mp2g=
5+
github.com/aws/aws-sdk-go-v2/credentials v1.17.4 h1:h5Vztbd8qLppiPwX+y0Q6WiwMZgpd9keKe2EAENgAuI=
6+
github.com/aws/aws-sdk-go-v2/credentials v1.17.4/go.mod h1:+30tpwrkOgvkJL1rUZuRLoxcJwtI/OkeBLYnHxJtVe0=
7+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.2 h1:AK0J8iYBFeUk2Ax7O8YpLtFsfhdOByh2QIkHmigpRYk=
8+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.2/go.mod h1:iRlGzMix0SExQEviAyptRWRGdYNo3+ufW/lCzvKVTUc=
9+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.2 h1:bNo4LagzUKbjdxE0tIcR9pMzLR2U/Tgie1Hq1HQ3iH8=
10+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.2/go.mod h1:wRQv0nN6v9wDXuWThpovGQjqF1HFdcgWjporw14lS8k=
11+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2 h1:EtOU5jsPdIQNP+6Q2C5e3d65NKT1PeCiQk+9OdzO12Q=
12+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2/go.mod h1:tyF5sKccmDz0Bv4NrstEr+/9YkSPJHrcO7UsUKf7pWM=
13+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU=
14+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY=
15+
github.com/aws/aws-sdk-go-v2/service/cloudfront v1.35.1 h1:svIAj0MQHRi8tbEhLAVmzaVEVwUsfQTpKumqDaiY0BA=
16+
github.com/aws/aws-sdk-go-v2/service/cloudfront v1.35.1/go.mod h1:m6lC61MrqoPdj7DHdlHp5NwbiEkoZOdrT8WuDPkkUv4=
17+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 h1:EyBZibRTVAs6ECHZOw5/wlylS9OcTzwyjeQMudmREjE=
18+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1/go.mod h1:JKpmtYhhPs7D97NL/ltqz7yCkERFW5dOlHyVl66ZYF8=
19+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.2 h1:5ffmXjPtwRExp1zc7gENLgCPyHFbhEPwVTkTiH9niSk=
20+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.2/go.mod h1:Ru7vg1iQ7cR4i7SZ/JTLYN9kaXtbL69UdgG0OQWQxW0=
21+
github.com/aws/aws-sdk-go-v2/service/sso v1.20.1 h1:utEGkfdQ4L6YW/ietH7111ZYglLJvS+sLriHJ1NBJEQ=
22+
github.com/aws/aws-sdk-go-v2/service/sso v1.20.1/go.mod h1:RsYqzYr2F2oPDdpy+PdhephuZxTfjHQe7SOBcZGoAU8=
23+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1 h1:9/GylMS45hGGFCcMrUZDVayQE1jYSIN6da9jo7RAYIw=
24+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1/go.mod h1:YjAPFn4kGFqKC54VsHs5fn5B6d+PCY2tziEa3U/GB5Y=
25+
github.com/aws/aws-sdk-go-v2/service/sts v1.28.1 h1:3I2cBEYgKhrWlwyZgfpSO2BpaMY1LHPqXYk/QGlu2ew=
26+
github.com/aws/aws-sdk-go-v2/service/sts v1.28.1/go.mod h1:uQ7YYKZt3adCRrdCBREm1CD3efFLOUNH77MrUCvx5oA=
27+
github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw=
28+
github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E=
329
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
430
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
531
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
632
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
33+
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
34+
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
735
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
836
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
937
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
@@ -17,7 +45,6 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
1745
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
1846
github.com/paulhammond/licensepack v0.0.0-20230830042735-3a27d821c8c0 h1:o4fePrfzf2Newuh+clPyQ0ZNksY8EAMRq1FkSnc2znQ=
1947
github.com/paulhammond/licensepack v0.0.0-20230830042735-3a27d821c8c0/go.mod h1:5t0FjjVbokg9/Tk6hUZ1PwKSpnPJeRDwzeCpM6cl+wg=
20-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
2148
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2249
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2350
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
@@ -34,7 +61,6 @@ golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
3461
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
3562
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
3663
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
37-
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
3864
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
3965
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
4066
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
@@ -47,7 +73,6 @@ golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
4773
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
4874
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
4975
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
50-
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5176
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5277
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5378
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -65,7 +90,6 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
6590
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
6691
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
6792
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
68-
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
6993
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
7094
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
7195
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=

internal/cftest/cloudfront.go

+23-15
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
package cftest
22

33
import (
4+
"context"
45
"encoding/json"
56
"strings"
67

7-
"github.com/aws/aws-sdk-go/aws"
8-
"github.com/aws/aws-sdk-go/aws/session"
9-
"github.com/aws/aws-sdk-go/service/cloudfront"
8+
"github.com/aws/aws-sdk-go-v2/aws"
9+
"github.com/aws/aws-sdk-go-v2/config"
10+
"github.com/aws/aws-sdk-go-v2/service/cloudfront"
11+
"github.com/aws/aws-sdk-go-v2/service/cloudfront/types"
1012
)
1113

1214
type cloudFrontRunner struct {
13-
cf *cloudfront.CloudFront
15+
cf *cloudfront.Client
1416
ifMatch *string
1517
name string
16-
stage string
18+
stage types.FunctionStage
1719
}
1820

1921
func (c cloudFrontRunner) Name() string {
20-
return c.name + " " + c.stage
22+
return c.name + " " + string(c.stage)
2123
}
2224

23-
func (c cloudFrontRunner) Run(e testEvent) (*cloudfront.TestResult, error) {
25+
func (c cloudFrontRunner) Run(ctx context.Context, e testEvent) (*types.TestResult, error) {
2426

2527
eventBytes, err := json.Marshal(e)
2628
if err != nil {
@@ -31,10 +33,10 @@ func (c cloudFrontRunner) Run(e testEvent) (*cloudfront.TestResult, error) {
3133
EventObject: eventBytes,
3234
IfMatch: c.ifMatch,
3335
Name: &c.name,
34-
Stage: &c.stage,
36+
Stage: c.stage,
3537
}
3638

37-
r, err := c.cf.TestFunction(&input)
39+
r, err := c.cf.TestFunction(ctx, &input)
3840
if err != nil {
3941
return nil, err
4042
}
@@ -46,14 +48,20 @@ func (c cloudFrontRunner) Run(e testEvent) (*cloudfront.TestResult, error) {
4648
return r.TestResult, nil
4749
}
4850

49-
func NewCloudFrontRunner(name string, stage string) (Runner, error) {
51+
func NewCloudFrontRunner(ctx context.Context, name string, stage string) (Runner, error) {
5052

51-
s := session.Must(session.NewSession())
52-
cf := cloudfront.New(s)
53+
cfg, err := config.LoadDefaultConfig(ctx)
54+
if err != nil {
55+
return nil, err
56+
}
57+
58+
functionStage := types.FunctionStage(stage)
59+
60+
cf := cloudfront.NewFromConfig(cfg)
5361

54-
r, err := cf.DescribeFunction(&cloudfront.DescribeFunctionInput{
62+
r, err := cf.DescribeFunction(ctx, &cloudfront.DescribeFunctionInput{
5563
Name: aws.String(name),
56-
Stage: aws.String(stage),
64+
Stage: functionStage,
5765
})
5866

5967
if err != nil {
@@ -64,7 +72,7 @@ func NewCloudFrontRunner(name string, stage string) (Runner, error) {
6472
cf: cf,
6573
ifMatch: r.ETag,
6674
name: name,
67-
stage: stage,
75+
stage: functionStage,
6876
}
6977
return runner, nil
7078
}

internal/cftest/run.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package cftest
22

33
import (
4+
"context"
45
"encoding/json"
56
"fmt"
67
"strconv"
78
"strings"
89

9-
"github.com/aws/aws-sdk-go/aws"
10-
"github.com/aws/aws-sdk-go/service/cloudfront"
10+
"github.com/aws/aws-sdk-go-v2/aws"
11+
"github.com/aws/aws-sdk-go-v2/service/cloudfront/types"
1112
"github.com/kylelemons/godebug/pretty"
1213
)
1314

@@ -18,28 +19,28 @@ type Result struct {
1819
}
1920

2021
type Runner interface {
21-
Run(e testEvent) (*cloudfront.TestResult, error)
22+
Run(ctx context.Context, e testEvent) (*types.TestResult, error)
2223
Name() string
2324
}
2425

25-
func RunTest(runner Runner, test Test) (Result, error) {
26+
func RunTest(ctx context.Context, runner Runner, test Test) (Result, error) {
2627

2728
result := Result{}
2829
failures := []string{}
2930

30-
testResult, err := runner.Run(test.Event)
31+
testResult, err := runner.Run(ctx, test.Event)
3132
if err != nil {
3233
return result, err
3334
}
3435

3536
if testResult.ComputeUtilization != nil {
36-
result.Utilization, err = strconv.Atoi(aws.StringValue(testResult.ComputeUtilization))
37+
result.Utilization, err = strconv.Atoi(aws.ToString(testResult.ComputeUtilization))
3738
if err != nil {
3839
return result, err
3940
}
4041
}
4142

42-
if gotError := aws.StringValue(testResult.FunctionErrorMessage); gotError != test.Error {
43+
if gotError := aws.ToString(testResult.FunctionErrorMessage); gotError != test.Error {
4344
failures = append(failures, fmt.Sprintf("Error (-got +want):\n%s", pretty.Compare(gotError, test.Error)))
4445
}
4546

internal/cftest/run_test.go

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package cftest
22

33
import (
4+
"context"
45
"encoding/json"
56
"errors"
67
"reflect"
78
"testing"
89

9-
"github.com/aws/aws-sdk-go/aws"
10-
"github.com/aws/aws-sdk-go/service/cloudfront"
10+
"github.com/aws/aws-sdk-go-v2/aws"
11+
"github.com/aws/aws-sdk-go-v2/service/cloudfront/types"
1112
)
1213

1314
type hash map[string]interface{}
@@ -33,11 +34,11 @@ func makeResult(uri string) string {
3334
}
3435

3536
type testRunner struct {
36-
result *cloudfront.TestResult
37+
result *types.TestResult
3738
err error
3839
}
3940

40-
func (r testRunner) Run(e testEvent) (*cloudfront.TestResult, error) {
41+
func (r testRunner) Run(ctx context.Context, e testEvent) (*types.TestResult, error) {
4142
return r.result, r.err
4243
}
4344

@@ -57,7 +58,7 @@ func TestRunTest(t *testing.T) {
5758
{
5859
name: "ok",
5960
testfile: "testdata/index.json",
60-
runner: testRunner{result: &cloudfront.TestResult{
61+
runner: testRunner{result: &types.TestResult{
6162
ComputeUtilization: aws.String("23"),
6263
FunctionOutput: aws.String(makeResult("/")),
6364
}},
@@ -70,7 +71,7 @@ func TestRunTest(t *testing.T) {
7071
{
7172
name: "expected test error",
7273
testfile: "testdata/error.json",
73-
runner: testRunner{result: &cloudfront.TestResult{
74+
runner: testRunner{result: &types.TestResult{
7475
ComputeUtilization: aws.String("23"),
7576
FunctionErrorMessage: aws.String("thrown error"),
7677
}},
@@ -83,7 +84,7 @@ func TestRunTest(t *testing.T) {
8384
{
8485
name: "expected test error with empty output",
8586
testfile: "testdata/error.json",
86-
runner: testRunner{result: &cloudfront.TestResult{
87+
runner: testRunner{result: &types.TestResult{
8788
ComputeUtilization: aws.String("23"),
8889
FunctionErrorMessage: aws.String("thrown error"),
8990
FunctionOutput: aws.String("{}"),
@@ -97,7 +98,7 @@ func TestRunTest(t *testing.T) {
9798
{
9899
name: "output different",
99100
testfile: "testdata/index.json",
100-
runner: testRunner{result: &cloudfront.TestResult{
101+
runner: testRunner{result: &types.TestResult{
101102
ComputeUtilization: aws.String("23"),
102103
FunctionOutput: aws.String(makeResult("/nomatch")),
103104
}},
@@ -126,7 +127,7 @@ func TestRunTest(t *testing.T) {
126127
{
127128
name: "test error different",
128129
testfile: "testdata/error.json",
129-
runner: testRunner{result: &cloudfront.TestResult{
130+
runner: testRunner{result: &types.TestResult{
130131
ComputeUtilization: aws.String("23"),
131132
FunctionErrorMessage: aws.String("other error"),
132133
}},
@@ -147,7 +148,7 @@ func TestRunTest(t *testing.T) {
147148
{
148149
name: "json error",
149150
testfile: "testdata/index.json",
150-
runner: testRunner{result: &cloudfront.TestResult{
151+
runner: testRunner{result: &types.TestResult{
151152
FunctionOutput: aws.String("/"),
152153
}},
153154
err: errors.New("JSON decode error: invalid character '/' looking for beginning of value"),
@@ -161,7 +162,7 @@ func TestRunTest(t *testing.T) {
161162
panic(err)
162163
}
163164

164-
result, err := RunTest(runner, *test)
165+
result, err := RunTest(context.Background(), runner, *test)
165166

166167
checkErrorEqual(t, tt.name, err, tt.err)
167168

0 commit comments

Comments
 (0)