Documentation ¶
Index ¶
- Variables
- func CreateTmpDir(t *testing.T) (string, func())
- func Retry(t *testing.T, n int, d time.Duration, op func() error)
- func SetLegoCACertificates(t *testing.T, certPath string) func()
- func SkipIfPebbleDisabled(t *testing.T) bool
- type Pebble
- func (p *Pebble) AccountURLPrefix() string
- func (p *Pebble) AssertIssuedByPebble(t *testing.T, domain string, certificate []byte)
- func (p *Pebble) DirectoryURL() string
- func (p *Pebble) HTTPPort() int
- func (p *Pebble) Start(t *testing.T)
- func (p *Pebble) Stop(t *testing.T)
- func (p *Pebble) WaitReady(t *testing.T)
Constants ¶
This section is empty.
Variables ¶
var FlagUpdate = flag.Bool("update", false, "update golden files")
FlagUpdate signals that the tests should update their golden files. Note that not all golden files used throughout the package end in .golden. Especially key files have a different extension which is more practical.
Functions ¶
func CreateTmpDir ¶
CreateTmpDir creates a temporary directory.
It returns the path to the created temporary directory an a clean-up function which allows to delete it.
func Retry ¶
Retry retries op at most n times before it fails t. It sleeps for d after the first failure and then increases d by the next power of itself.
func SetLegoCACertificates ¶
SetLegoCACertificates sets the LEGO_CA_CERTIFICATES environment variable to certPath. This makes all new instances of the lego ACME client use the certificate located at certPath when connecting to the ACME server.
SetLegoCACertificates returns a function which reverts any changes this made to the environment. Always use it in the following way:
reset := SetLegoCACertificates(t, somePath) defer reset() ... test code ...
func SkipIfPebbleDisabled ¶
SkipIfPebbleDisabled checks whether the test should be skipped because pebble is not available.
At least the ACMEPROXY_PEBBLE_DIR environment variable has to be set, otherwise the test is skipped.
Types ¶
type Pebble ¶
type Pebble struct { TestCert string // contains filtered or unexported fields }
Pebble represents an instance of the pebble test server used for testing ACME protocol clients.
For more information about pebble see https://github.com/letsencrypt/pebble
func NewPebble ¶
NewPebble creates a new Pebble instance by reading the necessary configuration settings from environment variables or using defaults.
func (*Pebble) AccountURLPrefix ¶
AccountURLPrefix returns the prefix of all account URLs belonging to accounts issued by this instance of pebble.
func (*Pebble) AssertIssuedByPebble ¶
AssertIssuedByPebble asserts that the passed PEM encoded certificate is a valid certificate issued by this instance of pebble.
func (*Pebble) DirectoryURL ¶
DirectoryURL returns the directory URL of the pebble instance.