Skip to content

Commit

Permalink
chore: correction to a few synth entity names and refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pranav-new-relic committed Nov 16, 2023
1 parent 7f6610c commit 6602cf5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkg/synthetics/monitors_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestIntegrationMonitors(t *testing.T) {

synthetics := New(tc)

testIntegrationMonitor.Name = generateSyntheticsEntityNameForIntegrationTest("SECURE_CRED", false)
testIntegrationMonitor.Name = generateSyntheticsEntityNameForIntegrationTest("MONITOR", false)

// Test: Create
created, err := synthetics.CreateMonitor(testIntegrationMonitor)
Expand All @@ -55,7 +55,7 @@ func TestIntegrationMonitors(t *testing.T) {
require.NotNil(t, *monitor)

// Test: Update
updatedName := generateSyntheticsEntityNameForIntegrationTest("SECURE_CRED", true)
updatedName := generateSyntheticsEntityNameForIntegrationTest("MONITOR", true)
monitor.Name = updatedName
updated, err := synthetics.UpdateMonitor(*monitor)

Expand Down
18 changes: 10 additions & 8 deletions pkg/synthetics/synthetics_api_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,6 @@ func TestSyntheticsScriptBrowserMonitor_LegacyRuntime(t *testing.T) {
}

func TestSyntheticsPrivateLocation_Basic(t *testing.T) {

testAccountID, err := mock.GetTestAccountID()
if err != nil {
t.Skipf("%s", err)
Expand All @@ -696,15 +695,20 @@ func TestSyntheticsPrivateLocation_Basic(t *testing.T) {

createResp, err := a.SyntheticsCreatePrivateLocation(
testAccountID,
"test secure credential",
"test secure credential",
"Test Private Location",
generateSyntheticsEntityNameForIntegrationTest("PRIVATE_LOCATION", false),
true,
)

require.NoError(t, err)
require.NotNil(t, createResp)

updateResp, err := a.SyntheticsUpdatePrivateLocation("test secure credential", createResp.GUID, true)
updateResp, err := a.SyntheticsUpdatePrivateLocation(
"Test Private Location Description Updated",
createResp.GUID,
true,
)

require.NoError(t, err)
require.NotNil(t, updateResp)

Expand Down Expand Up @@ -1359,10 +1363,8 @@ func generateSyntheticsEntityNameForIntegrationTest(entityType string, updated b
}
return fmt.Sprintf("CLIENT-GO-TEST-SYNTHETICS-SECURE-CREDENTIAL-%s", mock.RandSeq(5))
case "PRIVATE_LOCATION":
if updated {
return fmt.Sprintf("client-go-test-synthetic-private-location-updated-%s", mock.RandSeq(5))
}
return fmt.Sprintf("client-go-test-synthetic-private-location-%s", mock.RandSeq(5))
// name cannot exceed 32 characters, else, an error is thrown upon creation
return fmt.Sprintf("client-go-test-synth-PL-%s", mock.RandSeq(5))
}
return ""
}

0 comments on commit 6602cf5

Please sign in to comment.