test

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2019 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountCounter

func CountCounter(counter prometheus.Counter) int

CountCounter returns the count by label and value of a prometheus metric

func CountCounterVecWithLabels

func CountCounterVecWithLabels(counterVec *prometheus.CounterVec, labels prometheus.Labels) int

CountCounterVecWithLabels returns the current count a prometheus CounterVec with the given labels. If there was a problem collecting the value then it panics.

func CountHistogramSamplesWithLabels

func CountHistogramSamplesWithLabels(histVec *prometheus.HistogramVec, labels prometheus.Labels) int

CountHistogramSamplesWithLabels returns the number of samples a given prometheus Histogram has seen with the given labels. If there was a problem collecting the sample count it panics.

func GaugeValueWithLabels

func GaugeValueWithLabels(vecGauge *prometheus.GaugeVec, labels prometheus.Labels) (int, error)

GaugeValueWithLabels returns the current value with the provided labels from the the GaugeVec argument, or an error if there was a problem collecting the value.

func MustCountHistogramSamplesWithLabels

func MustCountHistogramSamplesWithLabels(histVec *prometheus.HistogramVec, labels prometheus.Labels) int

func WriteTemp

func WriteTemp(t *testing.T, contents, prefix string) string

WriteTemp writes the provided contents to a temp file with the provided prefix and returns the path to the temp file. If there is an error, `t.Fatalf` is called to end the test.

Types

type SafeBuffer

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

SafeBuffer is a wrapper around a bytes.Buffer that is made safe for concurrent access. This is required for making a logger backed by a bytes buffer that can be used by a woodpecker instance across multiple goroutines without a data race.

func (*SafeBuffer) Read

func (b *SafeBuffer) Read(p []byte) (n int, err error)

Read safely reads from the wrapped buffer

func (*SafeBuffer) Reset

func (b *SafeBuffer) Reset()

Reset safely resets the wrapped buffer

func (*SafeBuffer) String

func (b *SafeBuffer) String() string

String safely reads from the wrapped buffer

func (*SafeBuffer) Write

func (b *SafeBuffer) Write(p []byte) (n int, err error)

Write safely writes to the wrapped buffer

Directories

Path Synopsis
cmd/ct-test-srv
This is a test server that implements the subset of RFC6962 APIs needed by ct-woodpecker.
This is a test server that implements the subset of RFC6962 APIs needed by ct-woodpecker.

Jump to

Keyboard shortcuts

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