-
Notifications
You must be signed in to change notification settings - Fork 737
s3manager: ensure parity between UploadInput and PutObjectInput #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for posting this PR @fsouza, looks like there are actually a couple fields that need to be updated. the s3manager's tests are supposed to catch this, but it looks like these test ignore the field's type, and only compare name. would you mind also updating the var emptyList = []string{}
func val(i interface{}, s string) interface{} {
- fmt.Println("INNER", i)
v, err := awsutil.ValuesAtPath(i, s)
if err != nil || len(v) == 0 {
return nil
@@ -772,7 +771,12 @@ func TestUploadInputS3PutObjectInputPairity(t *testing.T) {
bOnly := []string{}
for k, c := range matchings {
- if c == 1 && k != "ContentLength" {
+ if strings.HasPrefix(k, "Body-") || strings.HasPrefix(k, "ContentLength-") {
+ // Ignored fields
+ continue
+ }
+
+ if c == 1 {
aOnly = append(aOnly, k)
} else if c == 2 {
bOnly = append(bOnly, k)
@@ -850,18 +854,24 @@ func compareStructType(a, b reflect.Type) map[string]int {
for i := 0; i < len(aFields) || i < len(bFields); i++ {
if i < len(aFields) {
- c := matchings[aFields[i].Name]
- matchings[aFields[i].Name] = c + 1
+ name := matchName(aFields[i])
+ c := matchings[name]
+ matchings[name] = c + 1
}
if i < len(bFields) {
- c := matchings[bFields[i].Name]
- matchings[bFields[i].Name] = c + 2
+ name := matchName(bFields[i])
+ c := matchings[name]
+ matchings[name] = c + 2
}
}
return matchings
}
+func matchName(field reflect.StructField) string {
+ return field.Name + "-" + field.Type.String()
+}
+
func enumFields(v reflect.Type) []reflect.StructField {
fields := []reflect.StructField{}without your fix this updated tests should show the following errors: |
|
Hey @jasdel, thanks for the feedback. I implemented those fixes and Do you see that in your environment too? It looks like the code is trying to use an io.SectionReader (instead of *io.SectionReader) as an io.Reader. |
|
@fsouza hmm, I'm not running into that issue. Can you verify that you're pr is based of tip of the SDK? |
|
@jasdel yeah, with latest master :( I created this Dockerfile to show how to reproduce the issue: https://gist.github.com/fsouza/d0b6374b972dd3041b9d99de9db1fb9f The test also fails without applying the patch. |
|
@fsouza - Looks like one of our dependencies broke. I'll go ahead and take a look into this. |
|
@fsouza one workaround for this issue to update your Go workspace so that github.com/jmespath/go-jmespath is on 0b12d6b5. With git directly you can do: cd $(go env GOPATH)/src/github.com/jmespath/go-jmespath
git checkout 0b12d6b5Alternatively, if your application uses dep it should automatically pull in the correct version as the SDK uses 0b12d6b5 in its Gopkg.toml file. |
|
@jasdel thanks for the info, I'm using dep in the application. I checked out that version of go-jmespath locally and the tests are now passing: I think this PR is good for review now! :D |
|
Thanks for taking the time to put this PR together, and adding the test. The change looks good. |
Release v2.0.0-preview.2 (2018-01-15) === ### Services * Synced the V2 SDK with latests AWS service API definitions. ### SDK Bugs * `service/s3/s3manager`: Fix Upload Manger's UploadInput fields ([#89](#89)) * Fixes [#88](#88) * `aws`: Fix Pagination handling of empty string NextToken ([#94](#94)) * Fixes [#84](#84)
Fix #88.