testfake

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package testfake is a whole cloud on localhost.

It answers Render, Cloudflare and Neon from one HTTP server, in the envelope shapes those APIs really use, so a test can drive the actual binary end to end without an account anywhere. Point the three base-URL variables at it and upkeep cannot tell the difference.

It exists because "easy to test" has to mean something concrete: a contributor with no cloud access, and a pull request from a fork with no secrets, must both be able to run the whole suite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cloud

type Cloud struct {

	// Env is the Render service's environment, keyed by service id.
	Env map[string]map[string]string
	// Deploys counts triggered deploys, and DeployStatuses is walked one entry
	// per poll so a test can say "building, building, live".
	Deploys        int
	DeployStatuses []string
	// DeafWrites accepts every write and changes nothing — a provider that
	// normalises, defers, or simply lies.
	DeafWrites bool

	// Buckets that exist, and their two settings.
	Buckets    map[string]bool
	PublicR2   map[string]bool
	CORS       map[string]json.RawMessage
	PagesProj  map[string]json.RawMessage
	NeonBranch map[string][]string

	// Requests is every path the tool asked for, in order, so a test can assert
	// what it did NOT do as well as what it did.
	Requests []string
	// contains filtered or unexported fields
}

Cloud is a fake Render + Cloudflare + Neon. Every field is safe to read after a run and safe to set before one.

func New

func New() *Cloud

New starts a fake cloud with nothing configured in it.

func (*Cloud) Asked

func (c *Cloud) Asked(needle string) bool

Asked reports whether any request touched a path containing needle.

func (*Cloud) Close

func (c *Cloud) Close()

func (*Cloud) Environ

func (c *Cloud) Environ() map[string]string

Environ returns the variables that aim upkeep at this fake, ready to hand to a test's environment.

func (*Cloud) URL

func (c *Cloud) URL() string

URL is the base every provider should be pointed at.

Jump to

Keyboard shortcuts

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