Update vendored deps, including AWS SDK, openpgp, ftp, ...

This commit is contained in:
Andrey Smirnov
2018-04-05 17:46:45 +03:00
parent cef4fefc40
commit 0e6ee35942
1497 changed files with 450721 additions and 68034 deletions
+824 -223
View File
File diff suppressed because it is too large Load Diff
+39 -15
View File
@@ -6,8 +6,6 @@ import (
"bytes"
"testing"
"github.com/stretchr/testify/assert"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/awstesting/unit"
@@ -32,20 +30,30 @@ func TestCustomizations(t *testing.T) {
Body: payloadBuf,
})
err := req.Build()
assert.NoError(t, err)
if err != nil {
t.Errorf("expect no err, got %v", err)
}
// Sets API version
assert.Equal(t, req.ClientInfo.APIVersion, req.HTTPRequest.Header.Get("x-amz-glacier-version"))
if e, a := req.ClientInfo.APIVersion, req.HTTPRequest.Header.Get("x-amz-glacier-version"); e != a {
t.Errorf("expect %v, got %v", e, a)
}
// Sets Account ID
v, _ := awsutil.ValuesAtPath(req.Params, "AccountId")
assert.Equal(t, "-", *(v[0].(*string)))
if e, a := "-", *(v[0].(*string)); e != a {
t.Errorf("expect %v, got %v", e, a)
}
// Computes checksums
linear := "68aff0c5a91aa0491752bfb96e3fef33eb74953804f6a2f7b708d5bcefa8ff6b"
tree := "154e26c78fd74d0c2c9b3cc4644191619dc4f2cd539ae2a74d5fd07957a3ee6a"
assert.Equal(t, linear, req.HTTPRequest.Header.Get("x-amz-content-sha256"))
assert.Equal(t, tree, req.HTTPRequest.Header.Get("x-amz-sha256-tree-hash"))
if e, a := linear, req.HTTPRequest.Header.Get("x-amz-content-sha256"); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := tree, req.HTTPRequest.Header.Get("x-amz-sha256-tree-hash"); e != a {
t.Errorf("expect %v, got %v", e, a)
}
}
func TestShortcircuitTreehash(t *testing.T) {
@@ -55,25 +63,37 @@ func TestShortcircuitTreehash(t *testing.T) {
Checksum: aws.String("000"),
})
err := req.Build()
assert.NoError(t, err)
if err != nil {
t.Errorf("expect no err, got %v", err)
}
assert.Equal(t, "000", req.HTTPRequest.Header.Get("x-amz-sha256-tree-hash"))
if e, a := "000", req.HTTPRequest.Header.Get("x-amz-sha256-tree-hash"); e != a {
t.Errorf("expect %v, got %v", e, a)
}
}
func TestFillAccountIDWithNilStruct(t *testing.T) {
req, _ := svc.ListVaultsRequest(nil)
err := req.Build()
assert.NoError(t, err)
if err != nil {
t.Errorf("expect no err, got %v", err)
}
empty := "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
// Sets Account ID
v, _ := awsutil.ValuesAtPath(req.Params, "AccountId")
assert.Equal(t, "-", *(v[0].(*string)))
if e, a := "-", *(v[0].(*string)); e != a {
t.Errorf("expect %v, got %v", e, a)
}
// Does not set tree hash
assert.Equal(t, empty, req.HTTPRequest.Header.Get("x-amz-content-sha256"))
assert.Equal(t, "", req.HTTPRequest.Header.Get("x-amz-sha256-tree-hash"))
if e, a := empty, req.HTTPRequest.Header.Get("x-amz-content-sha256"); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := "", req.HTTPRequest.Header.Get("x-amz-sha256-tree-hash"); e != a {
t.Errorf("expect %v, got %v", e, a)
}
}
func TestHashOnce(t *testing.T) {
@@ -84,7 +104,11 @@ func TestHashOnce(t *testing.T) {
req.HTTPRequest.Header.Set("X-Amz-Sha256-Tree-Hash", "0")
err := req.Build()
assert.NoError(t, err)
if err != nil {
t.Errorf("expect no err, got %v", err)
}
assert.Equal(t, "0", req.HTTPRequest.Header.Get("x-amz-sha256-tree-hash"))
if e, a := "0", req.HTTPRequest.Header.Get("x-amz-sha256-tree-hash"); e != a {
t.Errorf("expect %v, got %v", e, a)
}
}
+1 -1
View File
@@ -40,7 +40,7 @@
//
// Using the Client
//
// To Amazon Glacier with the SDK use the New function to create
// To contact Amazon Glacier with the SDK use the New function to create
// a new service client. With that client you can make API requests to the service.
// These clients are safe to use concurrently.
//
+4 -2
View File
@@ -3,6 +3,8 @@ package glacier
import (
"crypto/sha256"
"io"
"github.com/aws/aws-sdk-go/internal/sdkio"
)
const bufsize = 1024 * 1024
@@ -18,8 +20,8 @@ type Hash struct {
//
// See http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html for more information.
func ComputeHashes(r io.ReadSeeker) Hash {
r.Seek(0, 0) // Read the whole stream
defer r.Seek(0, 0) // Rewind stream at end
start, _ := r.Seek(0, sdkio.SeekCurrent) // Read the whole stream
defer r.Seek(start, sdkio.SeekStart) // Rewind stream at end
buf := make([]byte, bufsize)
hashes := [][]byte{}