Skip to content

Commit

Permalink
fix(integration-tests): Resolve newrelic-client-go failed integrati…
Browse files Browse the repository at this point in the history
…on tests (#1264)
  • Loading branch information
Aashirwadjain authored Jan 29, 2025
1 parent 6336f71 commit 1267425
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 3 deletions.
65 changes: 63 additions & 2 deletions pkg/synthetics/synthetics_api_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,11 @@ func TestSyntheticsScriptApiMonitorLegacy_Basic(t *testing.T) {
Period: SyntheticsMonitorPeriodTypes.EVERY_5_MINUTES,
Status: SyntheticsMonitorStatusTypes.ENABLED,
Script: apiScript,
Runtime: &SyntheticsRuntimeInput{
RuntimeTypeVersion: "16.10",
RuntimeType: "NODE_API",
ScriptLanguage: "JAVASCRIPT",
},
Tags: []SyntheticsTag{
{
Key: "pineapple",
Expand Down Expand Up @@ -967,8 +972,11 @@ func TestSyntheticsBrokenLinksMonitor_Basic(t *testing.T) {
Values: []string{"avocado"},
},
},
Uri: "https://www.google.com",
Runtime: &SyntheticsExtendedTypeMonitorRuntimeInput{},
Uri: "https://www.google.com",
Runtime: &SyntheticsExtendedTypeMonitorRuntimeInput{
RuntimeType: "NODE_API",
RuntimeTypeVersion: "16.10",
},
}

createdMonitor, err := a.SyntheticsCreateBrokenLinksMonitor(testAccountID, monitorInput)
Expand Down Expand Up @@ -1256,6 +1264,55 @@ func TestSyntheticsStepMonitor_WithMultiBrowserSupport(t *testing.T) {
require.Equal(t, createdMonitor.Monitor.GUID, deletedMonitor.DeletedGUID)
}

func TestSyntheticsStepMonitor_Fail(t *testing.T) {

testAccountID, err := mock.GetTestAccountID()
if err != nil {
t.Skipf("%s", err)
}

a := newIntegrationTestClient(t)

monitorName := generateSyntheticsEntityNameForIntegrationTest("MONITOR", false)
enableScreenshotOnFailureAndScript := true
monitorInput := SyntheticsCreateStepMonitorInput{
Name: monitorName,
Period: SyntheticsMonitorPeriodTypes.EVERY_DAY,
Status: SyntheticsMonitorStatusTypes.DISABLED,
AdvancedOptions: SyntheticsStepMonitorAdvancedOptionsInput{
EnableScreenshotOnFailureAndScript: &enableScreenshotOnFailureAndScript,
},
Locations: SyntheticsScriptedMonitorLocationsInput{
Public: []string{"AP_SOUTH_1"},
},
Tags: []SyntheticsTag{
{
Key: "step",
Values: []string{"monitor"},
},
},
Steps: []SyntheticsStepInput{
{
Ordinal: 0,
Type: SyntheticsStepTypeTypes.NAVIGATE,
Values: []string{"https://one.newrelic.com"},
},
{
Ordinal: 1,
Type: SyntheticsStepTypeTypes.ASSERT_TITLE,
Values: []string{"%=", "New Relic"}, // %= is used for "contains" logic
},
},
}

createdMonitor, err := a.SyntheticsCreateStepMonitor(testAccountID, monitorInput)

require.NoError(t, err)
require.NotNil(t, createdMonitor.Errors)
require.NotNil(t, createdMonitor)

}

func TestSyntheticsStepMonitor_GetSteps(t *testing.T) {
testAccountID, err := mock.GetTestAccountID()
if err != nil {
Expand All @@ -1276,6 +1333,10 @@ func TestSyntheticsStepMonitor_GetSteps(t *testing.T) {
Locations: SyntheticsScriptedMonitorLocationsInput{
Public: []string{"AP_SOUTH_1"},
},
Runtime: &SyntheticsExtendedTypeMonitorRuntimeInput{
RuntimeTypeVersion: "100",
RuntimeType: "CHROME_BROWSER",
},
Tags: []SyntheticsTag{
{
Key: "step",
Expand Down
3 changes: 2 additions & 1 deletion pkg/workflows/workflows_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ func TestIntegrationCreateWorkflow(t *testing.T) {
defer cleanupDestination(t, destination)

notificationTriggers := []AiWorkflowsNotificationTrigger{"ACTIVATED"}
var expectedUpdateOriginalMessage *bool = nil
isUpdated := true
var expectedUpdateOriginalMessage *bool = &isUpdated
// Create a workflow to work with in this test
workflowInput := generateCreateWorkflowInput(channel, notificationTriggers)

Expand Down

0 comments on commit 1267425

Please sign in to comment.