Documentation
¶
Overview ¶
Package s3test is an in-process fake of the S3 API for tests: one bucket, objects in memory, SigV4 signatures checked on every request, multipart uploads, ranged reads, ListObjects (v1) and injected failures. It speaks path style and virtual-host style (bucket.HOST).
Index ¶
- type Server
- func (s *Server) BucketURL(prefix string) string
- func (s *Server) Count(method string) int
- func (s *Server) CutNextBodies(n int)
- func (s *Server) Env(prefix string) func(string) string
- func (s *Server) FailNext(statuses ...int)
- func (s *Server) Keys() []string
- func (s *Server) Object(key string) ([]byte, bool)
- func (s *Server) OpenUploads() int
- func (s *Server) SetModified(key string, t time.Time)
- func (s *Server) SetObject(key string, b []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
*httptest.Server
Bucket string
Region string
Creds blob.Credentials
// contains filtered or unexported fields
}
Server is a running fake.
func New ¶
New starts a fake with bucket "vx-test" and test credentials; it stops when the test ends.
func (*Server) BucketURL ¶
BucketURL is the vx bucket URL for this fake with prefix, e.g. s3://vx-test/prefix?endpoint=http://127.0.0.1:PORT.
func (*Server) CutNextBodies ¶
CutNextBodies makes the next n GET responses stop after half the body, as a broken connection would.
func (*Server) Env ¶
Env returns a getenv for blob.OpenOptions with the fake's credentials under the prefix (VX_BLOB by default).
func (*Server) OpenUploads ¶
OpenUploads is how many multipart uploads were started and neither completed nor aborted.
func (*Server) SetModified ¶
SetModified changes when an object was last written, for retention tests.