Documentation
¶
Index ¶
- func DefaultJWKS() []byte
- func LocalhostCertificate() tls.Certificate
- func MakeClaims() jwt.MapClaims
- func MakeTCPServer() *ghttp.Server
- func MakeTCPTLSServer() (server *ghttp.Server, ca string)
- func MakeTokenObject(claims jwt.MapClaims) *jwt.Token
- func MakeTokenString(typ string, life time.Duration) string
- func RespondWithContent(status int, contentType, body string) http.HandlerFunc
- func RespondWithJSON(status int, body string) http.HandlerFunc
- func RespondWithObject(object any) http.HandlerFunc
- type Command
- type CommandBuilder
- func (b *CommandBuilder) AddArgs(args ...string) *CommandBuilder
- func (b *CommandBuilder) Build() (result *Command, err error)
- func (b *CommandBuilder) SetArgs(args ...string) *CommandBuilder
- func (b *CommandBuilder) SetDir(value string) *CommandBuilder
- func (b *CommandBuilder) SetLogger(value *slog.Logger) *CommandBuilder
- func (b *CommandBuilder) SetName(name string) *CommandBuilder
- type Database
- type DatabaseServer
- type Kind
- func (k *Kind) Client() crclient.WithWatch
- func (k *Kind) ClientSet() *kubernetes.Clientset
- func (k *Kind) Kubeconfig() []byte
- func (k *Kind) LoadArchive(ctx context.Context, archive string) error
- func (k *Kind) LoadImage(ctx context.Context, image string) error
- func (k *Kind) Start(ctx context.Context) error
- func (k *Kind) Stop(ctx context.Context) error
- type KindBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultJWKS ¶
func DefaultJWKS() []byte
DefaultJWKS generates the JSON web key set used for tests.
func LocalhostCertificate ¶
func LocalhostCertificate() tls.Certificate
LocalhostCertificate returns a self signed TLS certificate valid for the name `localhost` DNS name, for the `127.0.0.1` IPv4 address and for the `::1` IPv6 address.
A similar certificate can be generated with the following command:
openssl req \ -x509 \ -newkey rsa:4096 \ -nodes \ -keyout tls.key \ -out tls.crt \ -subj '/CN=localhost' \ -addext 'subjectAltName=DNS:localhost,IP:127.0.0.1,IP:::1' \ -days 1
func MakeClaims ¶
func MakeClaims() jwt.MapClaims
MakeClaims generates a default set of claims to be used to issue a token.
func MakeTCPServer ¶
MakeTCPServer creates a test server that listens in a TCP socket and configured so that it sends log messages to the Ginkgo writer.
func MakeTCPTLSServer ¶
MakeTCPTLSServer creates a test server configured so that it sends log messages to the Ginkgo writer. It returns the created server and the name of a temporary file that contains the CA certificate that the client should trust in order to connect to the server. It is the responsibility of the caller to delete this temporary file when it is no longer needed.
func MakeTokenObject ¶
func MakeTokenObject(claims jwt.MapClaims) *jwt.Token
MakeTokenObject generates a token with the claims resulting from merging the default claims and the claims explicitly given.
func MakeTokenString ¶
MakeTokenString generates a token issued by the default OpenID server and with the given type and with the given life. If the life is zero the token will never expire. If the life is positive the token will be valid, and expire after that time. If the life is negative the token will be already expired that time ago.
func RespondWithContent ¶
func RespondWithContent(status int, contentType, body string) http.HandlerFunc
RespondeWithContent responds with the given status code, content type and body.
func RespondWithJSON ¶
func RespondWithJSON(status int, body string) http.HandlerFunc
RespondWithJSON responds with the given status code and JSON body.
func RespondWithObject ¶
func RespondWithObject(object any) http.HandlerFunc
RespondWithObject returns an HTTP handler that responds with a single object.
Types ¶
type Command ¶ added in v0.0.7
type Command struct {
// contains filtered or unexported fields
}
Command helps manage execute a command line tool. Don't create instances of this type directly, use the NewCommand function instead.
type CommandBuilder ¶ added in v0.0.7
type CommandBuilder struct {
// contains filtered or unexported fields
}
CommandBuilder contains the data and logic needed to create an object that helps execute a command line tool. Don't create instances of this type directly, use the NewCommand function instead.
func NewCommand ¶ added in v0.0.7
func NewCommand() *CommandBuilder
NewCommand creates a builder that can then be used to configure and create a new command.
func (*CommandBuilder) AddArgs ¶ added in v0.0.7
func (b *CommandBuilder) AddArgs(args ...string) *CommandBuilder
AddArgs adds the arguments for the command. Note that this appends to any previously set arguments with the SetArgs method. Arguments are optional, if not set no arguments will be used.
func (*CommandBuilder) Build ¶ added in v0.0.7
func (b *CommandBuilder) Build() (result *Command, err error)
Build creates the command object.
func (*CommandBuilder) SetArgs ¶ added in v0.0.7
func (b *CommandBuilder) SetArgs(args ...string) *CommandBuilder
SetArgs sets the arguments for the command. Note that this replaces any previously arguments added with the AddArgs /method. Arguments are optional, if not set no arguments will be used.
func (*CommandBuilder) SetDir ¶ added in v0.0.7
func (b *CommandBuilder) SetDir(value string) *CommandBuilder
SetDir sets the directory where the command will be executed. This is optional, if not set the current working directory will be used.
func (*CommandBuilder) SetLogger ¶ added in v0.0.7
func (b *CommandBuilder) SetLogger(value *slog.Logger) *CommandBuilder
SetLogger sets the logger. This is mandatory.
func (*CommandBuilder) SetName ¶ added in v0.0.7
func (b *CommandBuilder) SetName(name string) *CommandBuilder
SetName sets the name of the command. This is mandatory.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database is a PostgreSQL database.
func (*Database) MakeHandle ¶
MakeHandle creates a new database handle for this database.
type DatabaseServer ¶
type DatabaseServer struct {
// contains filtered or unexported fields
}
DatabaseServer knows how to start a PostgreSQL database server inside a container, and how to create databases to be used for tests.
func MakeDatabaseServer ¶
func MakeDatabaseServer() *DatabaseServer
MakeDatabaseServer creates a new database server.
func (*DatabaseServer) MakeDatabase ¶
func (s *DatabaseServer) MakeDatabase() *Database
MakeDatabase creates a new database.
type Kind ¶ added in v0.0.7
type Kind struct {
// contains filtered or unexported fields
}
Kind helps manage a Kind cluster used for integration tests. Don't create instances of this type directly, use the NewKind function instead.
func (*Kind) ClientSet ¶ added in v0.0.7
func (k *Kind) ClientSet() *kubernetes.Clientset
ClientSet returns the Kubernetes set client for the cluster.
func (*Kind) Kubeconfig ¶ added in v0.0.7
Kubeconfig returns the kubeconfig bytes.
func (*Kind) LoadArchive ¶ added in v0.0.7
LoadArchive loads the specified image archive into the Kind cluster.
func (*Kind) LoadImage ¶ added in v0.0.7
LoadImage loads the specified image into the Kind cluster.
Note that this will take the image from the local Docker daemon, regardless of what provider was used to create the cluster. For example, if the cluster was created with the Podman provider this wills still load the image from Docker.
type KindBuilder ¶ added in v0.0.7
type KindBuilder struct {
// contains filtered or unexported fields
}
KindBuilder contains the data and logic needed to create an object that helps manage a Kind cluster used for integration tests. Don't create instances of this type directly, use the NewKind function instead.
func NewKind ¶ added in v0.0.7
func NewKind() *KindBuilder
NewKind creates a builder that can then be used to configure and create a new Kind cluster used for integration tests.
func (*KindBuilder) AddCrdFile ¶ added in v0.0.7
func (b *KindBuilder) AddCrdFile(file string) *KindBuilder
AddCrdFile adds a file containing custom resource definition to be installed in the cluster.
func (*KindBuilder) Build ¶ added in v0.0.7
func (b *KindBuilder) Build() (result *Kind, err error)
Build uses the configuration stored in the builder to create a new Kind cluster
func (*KindBuilder) SetLogger ¶ added in v0.0.7
func (b *KindBuilder) SetLogger(value *slog.Logger) *KindBuilder
SetLogger sets the logger. This is mandatory.
func (*KindBuilder) SetName ¶ added in v0.0.7
func (b *KindBuilder) SetName(name string) *KindBuilder
SetName sets the name of the Kind cluster. This is mandatory.