Documentation ¶
Index ¶
- Constants
- func GenerateRandomName(randCharCount int) string
- func GetNonExistentIDs() (string, string)
- func GetTestAccountID() (int, error)
- func GetTestUserID() (int, error)
- func NewIntegrationTestConfig(t *testing.T) config.Config
- func NewMockServer(t *testing.T, mockJSONResponse string, statusCode int) *httptest.Server
- func NewTestConfig(t *testing.T, testServer *httptest.Server) config.Config
- func RandSeq(n int) string
Constants ¶
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 )
const IntegrationTestAccountID = 3806526
Our integration test account ID (v2 account)
const IntegrationTestApplicationEntityGUID = "MzgwNjUyNnxBUE18QVBQTElDQVRJT058NTczNDgyNjM4"
Our integration test Dummy App
const IntegrationTestApplicationEntityGUIDNew = "MzgwNjUyNnxBUE18QVBQTElDQVRJT058NTUzNDQ4MjAy"
const IntegrationTestApplicationEntityNameNew = "Dummy App Pro Max"
name of the APM Application with the GUID IntegrationTestApplicationEntityGUIDNew
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomName ¶ added in v2.15.0
Use this method to generate a random name to be used in integration tests for whatever resource you might be trying to create and/or test. If no random character count is provided, the default behavior is to append 5 random letters to the end of the name.
Example random name: nr-test-xmnvb
func GetNonExistentIDs ¶ added in v2.17.1
GetNonExistentIDs returns two non-existent IDs that can be used to test errors raised when Ingest/User keys which do not exist are updated or deleted.
func GetTestAccountID ¶
GetTestAccountID returns the integer value for a New Relic Account ID from the environment
func GetTestUserID ¶
GetTestUserID returns the integer value for a New Relic user ID from the environment
func NewIntegrationTestConfig ¶
NewIntegrationTestConfig grabs environment vars for required fields or skips the test. returns a fully saturated configuration
func NewMockServer ¶
NewMockServer creates a server to respond to API calls for unit tests
func NewTestConfig ¶
NewTestConfig returns a fully saturated configration with modified BaseURLs for all endpoints based on the test server passed in
Types ¶
This section is empty.