Test will fail when we no longer gather requestId correctly.
@@ -4,6 +4,12 @@ import (
"net/http"
"strings"
"testing"
+
+ requestv2 "github.com/aws/aws-sdk-go-v2/aws"
+ restv2 "github.com/aws/aws-sdk-go-v2/private/protocol/rest"
+ "github.com/aws/aws-sdk-go-v2/service/lambda"
+ requestv1 "github.com/aws/aws-sdk-go/aws/request"
+ restv1 "github.com/aws/aws-sdk-go/private/protocol/rest"
)
func TestGetTableName(t *testing.T) {
@@ -75,4 +81,33 @@ func TestGetRequestID(t *testing.T) {
t.Error(i, out, test.hdr, test.expected)
}
}
+
+ // Make sure our assumptions still hold against aws-sdk-go
+ for _, test := range testcases {
+ req := &requestv1.Request{
+ HTTPResponse: &http.Response{
+ Header: test.hdr,
+ },
+ }
+ restv1.UnmarshalMeta(req)
+ if out := getRequestID(test.hdr); req.RequestID != out {
+ t.Error("requestId assumptions incorrect", out, req.RequestID,
+ test.hdr, test.expected)
+ }
+ }
+
+ // Make sure our assumptions still hold against aws-sdk-go-v2
+ for _, test := range testcases {
+ req := &requestv2.Request{
+ HTTPResponse: &http.Response{
+ Header: test.hdr,
+ },
+ Data: &lambda.InvokeOutput{},
+ }
+ restv2.UnmarshalMeta(req)
+ if out := getRequestID(test.hdr); req.RequestID != out {
+ t.Error("requestId assumptions incorrect", out, req.RequestID,
+ test.hdr, test.expected)
+ }
+ }
}
