{"id":16712751,"url":"https://github.com/aead/s3","last_synced_at":"2025-03-15T05:18:06.074Z","repository":{"id":57605022,"uuid":"127933484","full_name":"aead/s3","owner":"aead","description":"AWS S3 unit testing with the go test CLI","archived":false,"fork":false,"pushed_at":"2018-07-31T12:56:30.000Z","size":21,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-21T20:48:26.450Z","etag":null,"topics":["golang","minio","s3","test-driven-development","testing"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aead.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-03T16:01:18.000Z","updated_at":"2024-12-06T07:26:08.000Z","dependencies_parsed_at":"2022-09-13T01:33:51.396Z","dependency_job_id":null,"html_url":"https://github.com/aead/s3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aead%2Fs3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aead%2Fs3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aead%2Fs3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aead%2Fs3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aead","download_url":"https://codeload.github.com/aead/s3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685654,"owners_count":20330995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","minio","s3","test-driven-development","testing"],"created_at":"2024-10-12T20:43:57.401Z","updated_at":"2025-03-15T05:18:06.049Z","avatar_url":"https://github.com/aead.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Godoc Reference](https://godoc.org/github.com/aead/s3?status.svg)](https://godoc.org/github.com/aead/s3)\n[![Build Status](https://travis-ci.org/aead/s3.svg?branch=master)](https://travis-ci.org/aead/s3)\n[![Go Report Card](https://goreportcard.com/badge/aead/s3)](https://goreportcard.com/report/aead/s3)\n\n## AWS S3 unit testing library\n\n**S3** makes it possible to write AWS S3 unit tests and integrate them into\nthe Go development work-flow using the `go test` CLI.\n\n**Install:** `go get github.com/aead/s3`\n\n#### Run S3 tests\n\n 1. Install minio S3 server: `go get -u github.com/minio/minio`\n 2. Setup TLS:\n    - `openssl ecparam -genkey -name prime256v1 | openssl ec -out ~/.minio/certs/private.key`\n    - `openssl req -new -x509 -days 3650 -key ~/.minio/certs/private.key -out ~/.minio/certs/public.crt -subj \"/C=US/ST=state/L=location/O=organization/CN=domain\"`\n 3. Run S3 server: `minio server \u003cyour-dir\u003e`\n 4. Run S3 tests: `go test -v -short github.com/aead/s3 -args -access=your-access-key -secret=your-secret-key -insecure`\n\n#### Write S3 tests\n\n```\nimport (\n    \"bytes\"\n    \"crypto/tls\"\n    \"net/http\"\n    \"testing\"\n\n    \"github.com/aead/s3\"\n    \"github.com/minio/minio-go\"\n    \"github.com/minio/minio-go/pkg/encrypt\"\n)\n\nfunc TestEncryptedPut(t *testing.T) {\n        if err := s3.Parse(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tclient, err := minio.New(s3.Endpoint, s3.AccessKey, s3.SecretKey, true)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to create client: %v\", err)\n\t}\n\tclient.SetCustomTransport(\u0026http.Transport{\n\t\tTLSClientConfig: \u0026tls.Config{InsecureSkipVerify: s3.Insecure},\n\t})\n\n\tbucket := s3.BucketName(\"test-encrypted-put\")\n\tif remove, err := s3.MakeBucket(bucket, client.BucketExists, client.MakeBucket, client.RemoveBucket); err != nil {\n\t\tt.Fatalf(\"Failed to create bucket '%s': %s\", bucket, err)\n\t} else {\n\t\tdefer remove(t)\n\t}\n\n\tobject, data, password := \"object-1\", make([]byte, 5*1024*1024), \"my-password\"\n\tencryption := encrypt.DefaultPBKDF([]byte(password), []byte(bucket+object))\n\toptions := minio.PutObjectOptions{\n\t\tServerSideEncryption: encryption,\n\t}\n\n\tif _, err = client.PutObject(bucket, object, bytes.NewReader(data), int64(len(data)), options); err != nil {\n\t\tt.Fatalf(\"Failed to upload object '%s/%s': %s\", bucket, object, err)\n\t}\n\ts3.RemoveObject(bucket, object, client.RemoveObject, t)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faead%2Fs3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faead%2Fs3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faead%2Fs3/lists"}