mirror of
https://github.com/hanzoai/ca.git
synced 2026-11-03 18:08:27 +00:00
27 lines
1.1 KiB
Go
27 lines
1.1 KiB
Go
// Package testutils loads development test configuration and builds request, JSON and golden output assertions.
|
|
//
|
|
// Config paths resolve against the repository fixtures. JSON and JSONIndent
|
|
// are convenience helpers that intentionally swallow marshal errors;
|
|
// CompareJSON uses testing assertions.
|
|
//
|
|
// CreateURL, CreateURLs and CreateBindAddr return free ports, none twice in
|
|
// one process; another process may still bind one after the probe.
|
|
//
|
|
// NewTestCA builds an in-memory CA with real ECDSA keys for the DB and CA
|
|
// tests; the certificates it issues carry the key identifiers the service
|
|
// relies on:
|
|
//
|
|
// root := testutils.NewTestCA(t, "Test Root", nil)
|
|
// ca := testutils.NewTestCA(t, "Test L2", root)
|
|
// crt := ca.Issue(t, "peer.example.com", notBefore, notAfter)
|
|
//
|
|
// CheckGolden compares output a test suite captured with a golden file:
|
|
//
|
|
// testutils.CheckGolden(t, "testdata/prints_TestRpc.txt", entries)
|
|
//
|
|
// and rewrites the file instead when GoldenUpdateEnv is set and the suite
|
|
// passed:
|
|
//
|
|
// TRUSTYCA_UPDATE_GOLDEN=1 go test ./api/cli/command
|
|
package testutils
|