Closed johannesboyne closed 2 years ago
Next to the explanation, one could add a simple test-case to start tracking whether the general v2 access works.
v2
E.g., like this
package gofakes3_test import ( "bytes" "context" "crypto/tls" "net/http" "testing" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/s3" "github.com/johannesboyne/gofakes3" "github.com/johannesboyne/gofakes3/backend/s3mem" ) func TestAWSV2Example(t *testing.T) { ts := newTestServer(t, withBackend(&backendWithUnimplementedPaging{s3mem.New()}), withFakerOptions(gofakes3.WithUnimplementedPageError()), ) defer ts.Close() cfg, _ := config.LoadDefaultConfig( context.TODO(), config.WithSharedConfigProfile("test"), config.WithHTTPClient( &http.Client{ Transport: &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, }, }, ), config.WithEndpointResolver( aws.EndpointResolverFunc(func(service, region string) (aws.Endpoint, error) { return aws.Endpoint{URL: ts.server.URL}, nil }), ), ) // Create an Amazon S3 service client client := s3.NewFromConfig(cfg, func(o *s3.Options) { o.UsePathStyle = true }) ts.OKAll(client.PutObject(context.TODO(), &s3.PutObjectInput{ Bucket: aws.String(defaultBucket), Key: aws.String("ObjectKey"), Body: bytes.NewReader([]byte(`{"test": "foo"}`)), Metadata: map[string]string{ "Key": "MetadataValue", }, })) }
Kudos, SonarCloud Quality Gate passed!
0 Bugs 0 Vulnerabilities 0 Security Hotspots 0 Code Smells
No Coverage information No Duplication information
@shabbyrobe what's your view, is adding a v2 test-case helpful? It seems it takes a bit to complete - e.g., 2-3secs.
Next to the explanation, one could add a simple test-case to start tracking whether the general
v2
access works.E.g., like this