testhelpers

package
v0.79.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPTimeout    = 60 * time.Second                                  // HTTPTimeout increases the timeout for integration tests
	LicenseKey     = "APMLicenseKey"                                   // LicenseKey used in mock configs
	LogLevel       = "debug"                                           // LogLevel used in mock configs
	PersonalAPIKey = "personalAPIKey"                                  // PersonalAPIKey used in mock configs (from Environment for Integration tests)
	UserAgent      = "newrelic/newrelic-client-go (automated testing)" // UserAgent used in mock configs
)

Variables

This section is empty.

Functions

func GetTestAccountID added in v0.56.1

func GetTestAccountID() (int, error)

GetTestAccountID returns the integer value for a New Relic Account ID from the environment

func GetTestUserID added in v0.37.0

func GetTestUserID() (int, error)

GetTestUserID returns the integer value for a New Relic user ID from the environment

func NewIntegrationTestConfig

func NewIntegrationTestConfig(t *testing.T) config.Config

NewIntegrationTestConfig grabs environment vars for required fields or skips the test. returns a fully saturated configuration

func NewMockServer

func NewMockServer(t *testing.T, mockJSONResponse string, statusCode int) *httptest.Server

NewMockServer creates a server to respond to API calls for unit tests

func NewTestConfig

func NewTestConfig(t *testing.T, testServer *httptest.Server) config.Config

NewTestConfig returns a fully saturated configration with modified BaseURLs for all endpoints based on the test server passed in

func RandSeq

func RandSeq(n int) string

RandSeq is used to get a string made up of n random lowercase letters.

Types

This section is empty.

Jump to

Keyboard shortcuts

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