From 5ec94a1272dcc9dd2f21033fbc2f0d15006f1f90 Mon Sep 17 00:00:00 2001 From: pranav-new-relic Date: Mon, 30 Oct 2023 16:08:16 +0530 Subject: [PATCH] fix(synthetics_automated_testing): update to schema based on NG updates --- pkg/synthetics/synthetics_api.go | 2 ++ pkg/synthetics/synthetics_api_unit_test.go | 24 ++++++++++++++++------ pkg/synthetics/types.go | 15 +++++++------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/pkg/synthetics/synthetics_api.go b/pkg/synthetics/synthetics_api.go index 97da02bc..1e99a2d2 100644 --- a/pkg/synthetics/synthetics_api.go +++ b/pkg/synthetics/synthetics_api.go @@ -1485,6 +1485,8 @@ const getAutomatedTestResultQuery = `query( platform repository } + finishTimestamp + startTimestamp status tests { automatedTestMonitorConfig { diff --git a/pkg/synthetics/synthetics_api_unit_test.go b/pkg/synthetics/synthetics_api_unit_test.go index 6973de56..9c57c3fe 100644 --- a/pkg/synthetics/synthetics_api_unit_test.go +++ b/pkg/synthetics/synthetics_api_unit_test.go @@ -142,13 +142,25 @@ var ( Config: SyntheticsAutomatedTestMonitorConfigInput{ IsBlocking: true, Overrides: &SyntheticsAutomatedTestOverridesInput{ - Domain: SyntheticsScriptDomainOverrideInput{ - Domain: "sample-domain", - Override: "sample-override", + Domain: []SyntheticsScriptDomainOverrideInput{ + { + Domain: "sample-domain", + Override: "sample-override", + }, + { + Domain: "sample-domain-two", + Override: "sample-override-two", + }, }, - SecureCredential: SyntheticsSecureCredentialOverrideInput{ - Key: "sample-key", - OverrideKey: "sample-override-key", + SecureCredential: []SyntheticsSecureCredentialOverrideInput{ + { + Key: "sample-key", + OverrideKey: "sample-override-key", + }, + { + Key: "sample-key-two", + OverrideKey: "sample-override-key-two", + }, }, StartingURL: "sample-starting-url.com", Location: "sample-location", diff --git a/pkg/synthetics/types.go b/pkg/synthetics/types.go index bb40f089..381f2105 100644 --- a/pkg/synthetics/types.go +++ b/pkg/synthetics/types.go @@ -435,12 +435,9 @@ var SyntheticsStepTypeTypes = struct { // Account configuration data is queried through this object, as well as // telemetry data that is specific to a single account. type Account struct { - // - ID int `json:"id,omitempty"` - // + ID int `json:"id,omitempty"` LicenseKey string `json:"licenseKey,omitempty"` - // - Name string `json:"name,omitempty"` + Name string `json:"name,omitempty"` // This field provides access to Synthetics data. Synthetics SyntheticsAccountStitchedFields `json:"synthetics,omitempty"` } @@ -701,11 +698,11 @@ type SyntheticsAutomatedTestOverrides struct { // SyntheticsAutomatedTestOverridesInput - Automated test monitor overrides type SyntheticsAutomatedTestOverridesInput struct { // Override a domain throughout a scripted monitor - Domain SyntheticsScriptDomainOverrideInput `json:"domain,omitempty" yaml:"domain,omitempty"` + Domain []SyntheticsScriptDomainOverrideInput `json:"domain,omitempty" yaml:"domain,omitempty"` // Override monitor to use a specific location Location string `json:"location,omitempty" yaml:"location,omitempty"` // Override a script secure credential with another credential value - SecureCredential SyntheticsSecureCredentialOverrideInput `json:"secureCredential,omitempty" yaml:"secureCredential,omitempty"` + SecureCredential []SyntheticsSecureCredentialOverrideInput `json:"secureCredential,omitempty" yaml:"secureCredential,omitempty"` // Override a browser monitor starting url StartingURL string `json:"startingUrl,omitempty" yaml:"startingUrl,omitempty"` } @@ -714,6 +711,10 @@ type SyntheticsAutomatedTestOverridesInput struct { type SyntheticsAutomatedTestResult struct { // Automated test config Config SyntheticsAutomatedTestConfig `json:"config,omitempty"` + // Finished time of the automated test batch + FinishTimestamp *nrtime.EpochMilliseconds `json:"finishTimestamp,omitempty"` + // Start time of the automated test batch + StartTimestamp *nrtime.EpochMilliseconds `json:"startTimestamp,omitempty"` // Calculated status of automated test as a whole Status SyntheticsAutomatedTestStatus `json:"status,omitempty"` // List of completed automated test jobs