Skip to content

Commit 977ed3f

Browse files
committed
chore: revert formatting changes
1 parent 54b3e24 commit 977ed3f

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

daemon/internal/newrelic/processor_test.go

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ import (
1919
"github.com/newrelic/newrelic-php-agent/daemon/internal/newrelic/utilization"
2020
)
2121

22-
var (
23-
ErrPayloadTooLarge = errors.New("payload too large")
24-
ErrUnauthorized = errors.New("unauthorized")
25-
ErrUnsupportedMedia = errors.New("unsupported media")
26-
)
22+
var ErrPayloadTooLarge = errors.New("payload too large")
23+
var ErrUnauthorized = errors.New("unauthorized")
24+
var ErrUnsupportedMedia = errors.New("unsupported media")
2725

2826
type rpmException struct {
2927
Message string `json:"message"`
@@ -460,7 +458,7 @@ func TestUsageHarvest(t *testing.T) {
460458
// of harvests. So we extract the time from what we receive
461459
time1 := strings.Split(string(cp1.data), ",")[1]
462460
time2 := strings.Split(string(cp1.data), ",")[2]
463-
expectedJSON1 := `["one",` + time1 + `,` + time2 + `,` +
461+
var expectedJSON1 = `["one",` + time1 + `,` + time2 + `,` +
464462
`[[{"name":"Instance/Reporting"},[1,0,0,0,0,0]],` +
465463
`[{"name":"Supportability/AnalyticsEvents/TotalEventsSeen"},[0,0,0,0,0,0]],` +
466464
`[{"name":"Supportability/AnalyticsEvents/TotalEventsSent"},[0,0,0,0,0,0]],` +
@@ -480,7 +478,7 @@ func TestUsageHarvest(t *testing.T) {
480478
`[{"name":"Supportability/SpanEvent/TotalEventsSent"},[0,0,0,0,0,0]]]]`
481479
time1 = strings.Split(string(cp2.data), ",")[1]
482480
time2 = strings.Split(string(cp2.data), ",")[2]
483-
expectedJSON2 := `["one",` + time1 + `,` + time2 + `,` +
481+
var expectedJSON2 = `["one",` + time1 + `,` + time2 + `,` +
484482
`[[{"name":"Supportability/C/Collector/Output/Bytes"},[1,1253,0,0,0,0]],` +
485483
`[{"name":"Supportability/C/Collector/metric_data/Output/Bytes"},[1,1253,0,0,0,0]]]]`
486484

@@ -536,7 +534,7 @@ func TestUsageHarvestExceedChannel(t *testing.T) {
536534
time1 := strings.Split(string(cp.data), ",")[1]
537535
time2 := strings.Split(string(cp.data), ",")[2]
538536
// The data usage channel only holds 25 points until dropping data
539-
expectedJSON := `["one",` + time1 + `,` + time2 + `,` +
537+
var expectedJSON = `["one",` + time1 + `,` + time2 + `,` +
540538
`[[{"name":"Supportability/C/Collector/Output/Bytes"},[25,5275,0,0,0,0]],` +
541539
`[{"name":"Supportability/C/Collector/analytic_event_data/Output/Bytes"},[25,5275,0,0,0,0]]]]`
542540

@@ -596,7 +594,7 @@ func TestSupportabilityHarvest(t *testing.T) {
596594
// of harvests. So we extract the time from what we receive
597595
time1 := strings.Split(string(cp1.data), ",")[1]
598596
time2 := strings.Split(string(cp1.data), ",")[2]
599-
expectedJSON := `["one",` + time1 + `,` + time2 + `,` +
597+
var expectedJSON = `["one",` + time1 + `,` + time2 + `,` +
600598
`[[{"name":"Instance/Reporting"},[2,0,0,0,0,0]],` +
601599
`[{"name":"Supportability/Agent/Collector/HTTPError/408"},[1,0,0,0,0,0]],` + // Check for HTTPError Supportability metric
602600
`[{"name":"Supportability/Agent/Collector/metric_data/Attempts"},[1,0,0,0,0,0]],` + // Metrics were sent first when the 408 error occurred, so check for the metric failure.
@@ -619,7 +617,7 @@ func TestSupportabilityHarvest(t *testing.T) {
619617
time1 = strings.Split(string(cp2.data), ",")[1]
620618
time2 = strings.Split(string(cp2.data), ",")[2]
621619
// includes usage of the first data usage metrics sent
622-
expectedJSON2 := `["one",` + time1 + `,` + time2 + `,` +
620+
var expectedJSON2 = `["one",` + time1 + `,` + time2 + `,` +
623621
`[[{"name":"Supportability/C/Collector/Output/Bytes"},[2,1584,0,0,0,0]],` +
624622
`[{"name":"Supportability/C/Collector/metric_data/Output/Bytes"},[2,1584,0,0,0,0]]]]`
625623

@@ -949,7 +947,7 @@ func TestProcessorHarvestSplitTxnEvents(t *testing.T) {
949947
// usage metrics comparison
950948
time1 := strings.Split(string(cp3.data), ",")[1]
951949
time2 := strings.Split(string(cp3.data), ",")[2]
952-
expectedJSON := `["one",` + time1 + `,` + time2 + `,` +
950+
var expectedJSON = `["one",` + time1 + `,` + time2 + `,` +
953951
`[[{"name":"Supportability/C/Collector/Output/Bytes"},[6,289520,0,0,0,0]],` +
954952
`[{"name":"Supportability/C/Collector/analytic_event_data/Output/Bytes"},[5,288261,0,0,0,0]],` +
955953
`[{"name":"Supportability/C/Collector/metric_data/Output/Bytes"},[1,1259,0,0,0,0]]]]`
@@ -1485,6 +1483,7 @@ func TestShouldConnect(t *testing.T) {
14851483
// Be aware the agentLimit will be scaled down by 12 (60/5) before being compared to the
14861484
// collectorLimit.
14871485
func runMockedCollectorHarvestLimitTest(t *testing.T, eventType string, agentLimit uint64, collectorLimit uint64, testName string) {
1486+
14881487
// setup non-zero agent limits for log events
14891488
// NOTE: This limit is based on a 60 second harvest period!
14901489
// So the actual value used to compare to the collector
@@ -1565,6 +1564,7 @@ func runMockedCollectorHarvestLimitTest(t *testing.T, eventType string, agentLim
15651564
}
15661565

15671566
func TestConnectNegotiateLogEventLimits(t *testing.T) {
1567+
15681568
// these tests exist for the log events (TestConnectNegotiateLogEventsLimit()) because at some point
15691569
// the collector would return the default limit (833) if 0 was passed as the log limit. These tests
15701570
// exercise logic in the daemon to enforce the smaller agent value
@@ -1573,9 +1573,11 @@ func TestConnectNegotiateLogEventLimits(t *testing.T) {
15731573
runMockedCollectorHarvestLimitTest(t, "log_event_data", 100*12, 100, "agent log limit equal to collector")
15741574
runMockedCollectorHarvestLimitTest(t, "log_event_data", 0, 100, "agent log limit == 0, collector != 0")
15751575
runMockedCollectorHarvestLimitTest(t, "log_event_data", 100*12, 0, "agent log limit != 0, collector == 0")
1576+
15761577
}
15771578

15781579
func TestConnectNegotiateCustomEventLimits(t *testing.T) {
1580+
15791581
runMockedCollectorHarvestLimitTest(t, "custom_event_data", 110*12, 100, "agent custom limit larger than collector")
15801582
runMockedCollectorHarvestLimitTest(t, "custom_event_data", 100*12, 100, "agent custom limit equal to collector")
15811583
}
@@ -1598,6 +1600,7 @@ func TestProcessLogEventLimit(t *testing.T) {
15981600
}
15991601

16001602
func TestMissingAgentAndCollectorHarvestLimit(t *testing.T) {
1603+
16011604
// tests missing agent and collector harvest limits will not crash daemon
16021605
// and results in empty final harvest values
16031606
appInfo := sampleAppInfo

0 commit comments

Comments
 (0)