testwebapp

package
v0.0.0-...-59e91a1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

README

Package cloudeng.io/webapp/testwebapp

import cloudeng.io/webapp/testwebapp

Variables

ErrGoGetUnexpectedError, ErrGoGetPathNotFound, ErrGoGetNotFound, ErrGoGetContentMismatch
ErrGoGetUnexpectedError = errors.New("go-get unexpected error")
ErrGoGetPathNotFound = errors.New("go-get path not found")
ErrGoGetNotFound = errors.New("go-get meta tag not found")
ErrGoGetContentMismatch = errors.New("go-get meta tag content mismatch")

ErrRedirectUnexpectedError, ErrRedirectPathNotFound, ErrRedirectTargetMismatch, ErrRedirectStatusCodeMismatch
ErrRedirectUnexpectedError = errors.New("redirect unexpected error")
ErrRedirectPathNotFound = errors.New("redirect path not found")
ErrRedirectTargetMismatch = errors.New("redirect target mismatch")
ErrRedirectStatusCodeMismatch = errors.New("redirect status code mismatch")

ErrTLSSpecUnexpectedError, ErrTLSInvalidSerialNumbers, ErrTLSInvalidValidFor, ErrTLSInvalidIssuer
ErrTLSSpecUnexpectedError = errors.New("tls unexpected error")
ErrTLSInvalidSerialNumbers = errors.New("tls invalid serial numbers")
ErrTLSInvalidValidFor = errors.New("tls invalid duration")
ErrTLSInvalidIssuer = errors.New("tls invalid issuer")

Types

Type GoGetTest
type GoGetTest struct {
	// contains filtered or unexported fields
}

GoGetTest can be used to validate go-get meta tags for a set of import paths.

Functions
func NewGoGetTest(tlsClient *http.Client, specs ...goget.Spec) *GoGetTest
Methods
func (g GoGetTest) Run(ctx context.Context) error
Type HealthzSpec
type HealthzSpec struct {
	URL             string        `yaml:"url" json:"url"`
	Interval        time.Duration `yaml:"interval" json:"interval"`
	Timeout         time.Duration `yaml:"timeout" json:"timeout"`
	NumHealthChecks int           `yaml:"num_health_checks" json:"num_health_checks"`
}
Type HealthzTest
type HealthzTest struct {
	// contains filtered or unexported fields
}

HealthzTest can be used to validate /healthz endpoints.

Functions
func NewHealthzTest(client *http.Client, specs ...HealthzSpec) *HealthzTest
Methods
func (h HealthzTest) Run(ctx context.Context) error
Type RedirectSpec
type RedirectSpec struct {
	URL    string `yaml:"url" json:"url"`
	Target string `yaml:"target" json:"target"`
	Code   int    `yaml:"code" json:"code"`
}

RedirectSpec represents a specification for a redirect test.

Type RedirectTest
type RedirectTest struct {
	// contains filtered or unexported fields
}

RedirectTest can be used to validate redirects for a set of URLs.

Functions
func NewRedirectTest(client *http.Client, redirects ...RedirectSpec) *RedirectTest

NewRedirectTest creates a new RedirectTest, if client.CheckRedirect is nil, it will be set to http.ErrUseLastResponse to ensure that redirects are not followed.

Methods
func (r RedirectTest) Run(ctx context.Context) error
Type TLSSpec
type TLSSpec struct {
	Host               string        `yaml:"host"`
	Port               string        `yaml:"port"`
	ExpandDNSNames     bool          `yaml:"expand-dns-names"`     // see tlsvalidate.WithExpandDNSNames
	CheckSerialNumbers bool          `yaml:"check-serial-numbers"` // see tlsvalidate.WithCheckSerialNumbers
	ValidFor           time.Duration `yaml:"valid-for"`            // see tlsvalidate.WithValidForAtLeast
	TLSMinVersion      uint16        `yaml:"tls-min-version"`      // see tlsvalidate.WithTLSMinVersion
	IssuerREs          []string      `yaml:"issuer-res"`           // see tlsvalidate.WithIssuerRegexps
	CustomCAPEM        string        `yaml:"custom-ca-pem"`        // used tlsvalidate.WithCustomRootCAPEM
	// contains filtered or unexported fields
}

TLSSpec represents a specification for a TLS test.

Functions
func WithCustomCAPEMFile(s []TLSSpec, pemFile string) []TLSSpec

WithCustomCAPEMFile sets the custom CA PEM file for all specs if not already set in each/any spec.

Type TLSTest
type TLSTest struct {
	// contains filtered or unexported fields
}

TLSTest can be used to validate TLS certificates for a set of hosts.

Functions
func NewTLSTest(specs ...TLSSpec) *TLSTest
Methods
func (t *TLSTest) Run(ctx context.Context) error

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGoGetUnexpectedError = errors.New("go-get unexpected error")
	ErrGoGetPathNotFound    = errors.New("go-get path not found")
	ErrGoGetNotFound        = errors.New("go-get meta tag not found")
	ErrGoGetContentMismatch = errors.New("go-get meta tag content mismatch")
)
View Source
var (
	ErrRedirectUnexpectedError    = errors.New("redirect unexpected error")
	ErrRedirectPathNotFound       = errors.New("redirect path not found")
	ErrRedirectTargetMismatch     = errors.New("redirect target mismatch")
	ErrRedirectStatusCodeMismatch = errors.New("redirect status code mismatch")
)
View Source
var (
	ErrTLSSpecUnexpectedError  = errors.New("tls unexpected error")
	ErrTLSInvalidSerialNumbers = errors.New("tls invalid serial numbers")
	ErrTLSInvalidValidFor      = errors.New("tls invalid duration")
	ErrTLSInvalidIssuer        = errors.New("tls invalid issuer")
)

Functions

This section is empty.

Types

type GoGetTest

type GoGetTest struct {
	// contains filtered or unexported fields
}

GoGetTest can be used to validate go-get meta tags for a set of import paths.

func NewGoGetTest

func NewGoGetTest(tlsClient *http.Client, specs ...goget.Spec) *GoGetTest

func (GoGetTest) Run

func (g GoGetTest) Run(ctx context.Context) error

type HealthzSpec

type HealthzSpec struct {
	URL             string        `yaml:"url" json:"url"`
	Interval        time.Duration `yaml:"interval" json:"interval"`
	Timeout         time.Duration `yaml:"timeout" json:"timeout"`
	NumHealthChecks int           `yaml:"num_health_checks" json:"num_health_checks"`
}

type HealthzTest

type HealthzTest struct {
	// contains filtered or unexported fields
}

HealthzTest can be used to validate /healthz endpoints.

func NewHealthzTest

func NewHealthzTest(client *http.Client, specs ...HealthzSpec) *HealthzTest

func (HealthzTest) Run

func (h HealthzTest) Run(ctx context.Context) error

type RedirectSpec

type RedirectSpec struct {
	URL    string `yaml:"url" json:"url"`
	Target string `yaml:"target" json:"target"`
	Code   int    `yaml:"code" json:"code"`
}

RedirectSpec represents a specification for a redirect test.

type RedirectTest

type RedirectTest struct {
	// contains filtered or unexported fields
}

RedirectTest can be used to validate redirects for a set of URLs.

func NewRedirectTest

func NewRedirectTest(client *http.Client, redirects ...RedirectSpec) *RedirectTest

NewRedirectTest creates a new RedirectTest, if client.CheckRedirect is nil, it will be set to http.ErrUseLastResponse to ensure that redirects are not followed.

func (RedirectTest) Run

func (r RedirectTest) Run(ctx context.Context) error

type TLSSpec

type TLSSpec struct {
	Host               string        `yaml:"host"`
	Port               string        `yaml:"port"`
	ExpandDNSNames     bool          `yaml:"expand-dns-names"`     // see tlsvalidate.WithExpandDNSNames
	CheckSerialNumbers bool          `yaml:"check-serial-numbers"` // see tlsvalidate.WithCheckSerialNumbers
	ValidFor           time.Duration `yaml:"valid-for"`            // see tlsvalidate.WithValidForAtLeast
	TLSMinVersion      uint16        `yaml:"tls-min-version"`      // see tlsvalidate.WithTLSMinVersion
	IssuerREs          []string      `yaml:"issuer-res"`           // see tlsvalidate.WithIssuerRegexps
	CustomCAPEM        string        `yaml:"custom-ca-pem"`        // used tlsvalidate.WithCustomRootCAPEM
	// contains filtered or unexported fields
}

TLSSpec represents a specification for a TLS test.

func WithCustomCAPEMFile

func WithCustomCAPEMFile(s []TLSSpec, pemFile string) []TLSSpec

WithCustomCAPEMFile sets the custom CA PEM file for all specs if not already set in each/any spec.

type TLSTest

type TLSTest struct {
	// contains filtered or unexported fields
}

TLSTest can be used to validate TLS certificates for a set of hosts.

func NewTLSTest

func NewTLSTest(specs ...TLSSpec) *TLSTest

func (*TLSTest) Run

func (t *TLSTest) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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