testhelpers

package
v0.47.2-0...-23ee662 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	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
	LicenseKey     = "APMLicenseKey"                                   // LicenseKey used in mock configs
)
View Source
const (
	// DTK Terraform Test Account
	TestAccountID = 2520528
)

Variables

View Source
var (
	TestUserID = os.Getenv("NEW_RELIC_TEST_USER_ID")
)

Functions

func GetTestUserID

func GetTestUserID() (int, error)

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