promremotetest

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package promremotetest provides test utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestPromServer

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

TestPromServer is a fake http server handling prometheus remote write. Intended for test usage.

func NewServer

func NewServer(t *testing.T) *TestPromServer

NewServer creates new instance of a fake server.

func (*TestPromServer) Close

func (s *TestPromServer) Close()

Close stops underlying http server.

func (*TestPromServer) GetLastWriteRequest

func (s *TestPromServer) GetLastWriteRequest() *prompb.WriteRequest

GetLastWriteRequest returns the last recorded write request.

func (*TestPromServer) Reset

func (s *TestPromServer) Reset()

Reset resets state to default.

func (*TestPromServer) SetError

func (s *TestPromServer) SetError(body string, status int)

SetError sets error that will be returned for all incoming requests.

func (*TestPromServer) WriteAddr

func (s *TestPromServer) WriteAddr() string

WriteAddr returns http address of a write endpoint.

Jump to

Keyboard shortcuts

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