testauthority

package
v0.9.63 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package testauthority builds an xpki authority.Authority for unit tests: a root and an issuing CA generated with xpki's testca, their keys in memory (inmemcrypto), and the profiles of testdata/ca-config.yaml (the chart's profiles without the Helm templating) loaded through authority.LoadConfig. It is imported by tests only (internal/controller, internal/operator/*); no non-test code depends on it.

ca := testauthority.New(t) // issuer label testauthority.IssuerLabel

Index

Constants

View Source
const (
	// IssuerLabel is the label of the issuer the Authority serves, the same
	// as the chart's.
	IssuerLabel = "kubeca.svc"
	// Profiles of the example configuration.
	ProfilePeer    = "peer-24h"
	ProfileServer  = "server-24h"
	ProfileClient  = "client-24h"
	ProfileWebhook = "webhook"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CA

type CA struct {
	*authority.Authority
	// Root and Issuer are the generated CA entities (certificate and key).
	Root   *testca.Entity
	Issuer *testca.Entity
	// Dir holds issuer.pem, issuer.key, root.pem and ca-config.yaml.
	Dir string
}

CA is a test Authority with its generated certificates.

func FromEntities

func FromEntities(t *testing.T, root, issuer *testca.Entity) *CA

FromEntities builds the Authority around the given root and issuing CA, so a test can control their validity (an expiring CA).

func New

func New(t *testing.T) *CA

New builds the Authority; it fails the test on any error.

func (*CA) RootPEM

func (ca *CA) RootPEM() string

RootPEM returns the root certificate, PEM.

Jump to

Keyboard shortcuts

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