fakes3

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package fakes3 is an in-process S3-compatible endpoint for Podium's own tests.

It exists so the suite needs no object store container at all, and because a fake that ignores authentication would make every presigned-URL test worthless: a URL that is accepted no matter what it is signed with proves nothing about signing. So the object semantics come from gofakes3, which speaks enough of the S3 API for minio-go — including the aws-chunked bodies minio-go sends over plain HTTP — and the AWS SigV4 verification in front of it is real: a presigned request whose signature, key, expiry or path has been touched is refused with 403.

Header-authenticated requests (everything the server itself does) are not verified. The credential is still checked for presence, but the signature is not recomputed: minio-go signs those bodies with a streaming signature whose chunk framing gofakes3 already unwraps, and re-deriving it would be reimplementing the client. Presigned URLs are the interesting half — they are the only thing Podium ever hands to somebody else — and those are verified in full.

It is test infrastructure. Nothing in cmd/ imports it.

Index

Constants

View Source
const (
	AccessKey = "podium-test-access-key"
	SecretKey = "podium-test-secret-key"
	Bucket    = "podium-test"
)

Credentials the fake accepts. They are obvious fixtures, not secrets.

Variables

This section is empty.

Functions

func DeadConfig

func DeadConfig(t *testing.T) artifacts.Config

DeadConfig points at a loopback port with nothing listening on it: what "the store is down" looks like to the control plane.

func VerifyPresigned

func VerifyPresigned(r *http.Request, accessKey, secretKey string) error

VerifyPresigned recomputes the AWS SigV4 query-string signature of r and reports whether it matches. It is the whole point of this package: without it a presign test asserts only that a URL was produced.

Types

type Server

type Server struct {
	// URL is the endpoint, "http://127.0.0.1:port".
	URL string
	// Rejected counts presigned requests refused for a bad signature.
	Rejected int
	// contains filtered or unexported fields
}

Server is a running fake endpoint.

func Start

func Start(t *testing.T) *Server

Start brings up a fake endpoint bound to loopback and stops it when the test ends.

func (*Server) Close

func (s *Server) Close()

Close stops the endpoint early. The test cleanup does it otherwise.

func (*Server) Config

func (s *Server) Config() artifacts.Config

Config is the Podium configuration that points at this endpoint.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL