test

package
v1.248.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Environment for test.
	Environment = env.Environment("dev")

	// Version for test.
	Version = env.Version("1.0.0")

	// Name for test.
	Name = env.Name("test")

	// UserAgent for test.
	UserAgent = env.UserAgent(string(Name) + "/" + string(Version))
)
View Source
var (
	//go:embed views/hello.tmpl.html
	//go:embed views/error.tmpl.html
	Views embed.FS

	// Model for test.
	Model = PageData{
		Title: "My TODO list",
		Todos: []Todo{
			{Title: "Task 1", Done: false},
			{Title: "Task 2", Done: true},
			{Title: "Task 3", Done: true},
		},
	}
)
View Source
var Compressor = compress.NewMap()

Compressor for tests.

View Source
var ErrInvalidToken = errors.New("invalid token")

ErrInvalidToken ...

View Source
var Marshaller = encoding.NewMap()

Marshaller for tests.

Functions

func NewAES added in v1.193.0

func NewAES() *aes.Config

NewAES for test.

func NewCompressor added in v1.57.3

func NewCompressor(err error) compress.Compressor

NewCompressor for test.

func NewEd25519 added in v1.193.0

func NewEd25519() *ed25519.Config

NewEd25519 for test.

func NewHMAC added in v1.193.0

func NewHMAC() *hmac.Config

NewHMAC for test.

func NewHook added in v1.138.0

func NewHook() *hooks.Config

NewHook for test.

func NewInputConfig added in v1.186.0

func NewInputConfig(flag string) *cmd.InputConfig

NewInputConfig for test.

func NewInsecureConfig added in v1.174.0

func NewInsecureConfig() *tls.Config

NewSecureClientConfig for test.

func NewInsecureDebugConfig added in v1.154.7

func NewInsecureDebugConfig() *debug.Config

NewInsecureDebugConfig for test.

func NewInsecureTransportConfig added in v1.113.0

func NewInsecureTransportConfig() *transport.Config

NewInsecureTransportConfig for test.

func NewLimiterConfig added in v1.166.0

func NewLimiterConfig(kind, interval string, tokens uint64) *limiter.Config

NewLimiterConfig for test.

func NewLogger added in v1.66.0

func NewLogger(lc fx.Lifecycle) *zap.Logger

NewLogger for test.

func NewMarshaller added in v1.57.3

func NewMarshaller(err error) encoding.Marshaller

NewMarshaller for test.

func NewMeter added in v1.152.0

func NewMeter(lc fx.Lifecycle, c *metrics.Config) metric.Meter

NewMeter for test.

func NewOTLPMeter added in v1.172.0

func NewOTLPMeter(lc fx.Lifecycle) metric.Meter

NewOTLPMeter for test.

func NewOTLPMetricsConfig added in v1.152.0

func NewOTLPMetricsConfig() *metrics.Config

NewOTLPMetricsConfig for test.

func NewOTLPTracerConfig added in v1.152.0

func NewOTLPTracerConfig() *tracer.Config

NewOTLPTracerConfig for test.

func NewOutputConfig added in v1.186.0

func NewOutputConfig(flag string) *cmd.OutputConfig

NewOutputConfig for test.

func NewPGConfig added in v1.66.4

func NewPGConfig() *pg.Config

NewPGConfig for test.

func NewPrometheusMeter added in v1.172.0

func NewPrometheusMeter(lc fx.Lifecycle) metric.Meter

NewPrometheusMeter for test.

func NewPrometheusMetricsConfig added in v1.152.0

func NewPrometheusMetricsConfig() *metrics.Config

NewPrometheusMetricsConfig for test.

func NewRSA added in v1.193.0

func NewRSA() *rsa.Config

NewRSA for test.

func NewRedisConfig added in v1.76.0

func NewRedisConfig(secret, compressor, marshaller string) *redis.Config

NewRedisConfig for test.

func NewRetry added in v1.134.0

func NewRetry() *retry.Config

NewRetry for test.

func NewSSH added in v1.214.0

func NewSSH() *ssh.Config

NewSSH for test.

func NewSecureDebugConfig added in v1.154.7

func NewSecureDebugConfig() *debug.Config

NewInsecureDebugConfig for test.

func NewSecureTransportConfig added in v1.113.0

func NewSecureTransportConfig() *transport.Config

NewSecureTransportConfig for test.

func NewTLSClientConfig added in v1.180.0

func NewTLSClientConfig() *tls.Config

NewTLSClientConfig for test.

func NewTLSConfig added in v1.180.0

func NewTLSConfig(c, k string) *tls.Config

NewTLSConfig for test.

func NewTLSServerConfig added in v1.180.0

func NewTLSServerConfig() *tls.Config

NewTLSServerConfig for test.

func NewToken added in v1.217.0

func NewToken() *token.Config

NewToken for test.

func Path added in v1.194.0

func Path(p string) string

Path for test.

func Port added in v1.87.2

func Port() string

Port for test.

func ProtobufSayHello added in v1.245.0

func ProtobufSayHello(_ context.Context, r *v1.SayHelloRequest) (*v1.SayHelloResponse, error)

func Test added in v1.108.0

func Test(ctx context.Context) meta.Valuer

Test retrieves sample info.

func WithTest added in v1.108.0

func WithTest(ctx context.Context, value meta.Valuer) context.Context

WithTest stores sample info.

Types

type Cache added in v1.172.2

type Cache struct {
	Lifecycle fx.Lifecycle
	Redis     *redis.Config
	Logger    *zap.Logger
	Tracer    *tracer.Config
	Meter     metric.Meter
}

Cache for test.

func (*Cache) NewRedisCache added in v1.172.2

func (c *Cache) NewRedisCache() (*cache.Cache, error)

NewRedisCache for test.

func (*Cache) NewRedisClient added in v1.172.2

func (c *Cache) NewRedisClient() (gr.Client, error)

NewRedisClient for test.

func (*Cache) NewRistrettoCache added in v1.172.2

func (c *Cache) NewRistrettoCache() sr.Cache

NewRistrettoCache for test.

type Client added in v1.172.2

type Client struct {
	Lifecycle    fx.Lifecycle
	Logger       *zap.Logger
	Tracer       *tracer.Config
	Transport    *transport.Config
	TLS          *tls.Config
	RoundTripper http.RoundTripper
	Meter        metric.Meter
	Generator    token.Generator
	Compression  bool
	H2C          bool
}

Client for test.

func (*Client) NewGRPC added in v1.172.2

func (c *Client) NewGRPC() *grpc.ClientConn

func (*Client) NewHTTP added in v1.172.2

func (c *Client) NewHTTP() *http.Client

NewHTTP client for test.

type Generator added in v1.32.3

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

Generator for test.

func NewGenerator added in v1.4.0

func NewGenerator(token string, err error) *Generator

NewGenerator for test.

func (*Generator) Generate added in v1.32.3

func (g *Generator) Generate(ctx context.Context) (context.Context, []byte, error)

type InvalidMeter added in v1.161.0

type InvalidMeter struct{ embedded.Meter }

InvalidMeter for test.

func (InvalidMeter) Float64Counter added in v1.161.0

func (InvalidMeter) Float64Gauge added in v1.200.0

func (InvalidMeter) Float64Histogram added in v1.161.0

func (InvalidMeter) Float64ObservableCounter added in v1.161.0

func (InvalidMeter) Float64ObservableGauge added in v1.161.0

func (InvalidMeter) Float64ObservableUpDownCounter added in v1.161.0

func (InvalidMeter) Float64UpDownCounter added in v1.161.0

func (InvalidMeter) Int64Counter added in v1.161.0

func (InvalidMeter) Int64Gauge added in v1.200.0

func (InvalidMeter) Int64Histogram added in v1.161.0

func (InvalidMeter) Int64ObservableCounter added in v1.161.0

func (InvalidMeter) Int64ObservableGauge added in v1.161.0

func (InvalidMeter) Int64ObservableUpDownCounter added in v1.161.0

func (InvalidMeter) Int64UpDownCounter added in v1.161.0

func (InvalidMeter) RegisterCallback added in v1.161.0

type PageData added in v1.246.0

type PageData struct {
	Title string
	Todos []Todo
}

type Request added in v1.241.0

type Request struct {
	Name string
}

type Response added in v1.241.0

type Response struct {
	Meta     meta.Map
	Greeting *string
}

func ErrorSayHello added in v1.245.0

func ErrorSayHello(_ context.Context, _ *Request) (*Response, error)

func SuccessSayHello added in v1.245.0

func SuccessSayHello(ctx context.Context, r *Request) (*Response, error)

type Server

type Server struct {
	Lifecycle  fx.Lifecycle
	Meter      metric.Meter
	Verifier   token.Verifier
	Mux        *http.ServeMux
	HTTP       *th.Server
	GRPC       *tg.Server
	Transport  *transport.Config
	Tracer     *tracer.Config
	Limiter    limiter.Store
	Key        lm.KeyFunc
	Logger     *zap.Logger
	VerifyAuth bool
}

Server for test.

func (*Server) Register added in v1.172.2

func (s *Server) Register()

Register server.

type Service added in v1.172.2

type Service struct {
	v1.UnimplementedGreeterServiceServer
	// contains filtered or unexported fields
}

Service ...

func NewService added in v1.172.2

func NewService(verifyAuth bool) *Service

NewService ...

func (*Service) SayHello added in v1.172.2

func (s *Service) SayHello(ctx context.Context, req *v1.SayHelloRequest) (*v1.SayHelloResponse, error)

SayHello ...

func (*Service) SayStreamHello added in v1.172.2

func (s *Service) SayStreamHello(stream v1.GreeterService_SayStreamHelloServer) error

SayStreamHello ...

type Shutdowner

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

func NewShutdowner

func NewShutdowner() *Shutdowner

func (*Shutdowner) Called added in v1.66.4

func (s *Shutdowner) Called() bool

func (*Shutdowner) Shutdown

func (s *Shutdowner) Shutdown(...fx.ShutdownOption) error

type Todo added in v1.246.0

type Todo struct {
	Title string
	Done  bool
}

type Verifier added in v1.32.3

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

Verifier for test.

func NewVerifier added in v1.4.0

func NewVerifier(token string) *Verifier

NewVerifier for test.

func (*Verifier) Verify added in v1.32.3

func (v *Verifier) Verify(ctx context.Context, token []byte) (context.Context, error)

Directories

Path Synopsis
greet
v1

Jump to

Keyboard shortcuts

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