Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewvc committed Mar 26, 2021
1 parent b55fd0a commit cba9081
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
24 changes: 12 additions & 12 deletions x-pack/heartbeat/monitors/browser/synthexec/synthtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ import (
)

type SynthEvent struct {
Type string `json:"type"`
PackageVersion string `json:"package_version"`
Step *Step `json:"step"`
Journey *Journey `json:"journey"`
TimestampEpochMicros float64 `json:"@timestamp"`
Payload common.MapStr `json:"payload"`
Blob string `json:"blob"`
BlobMime string `json:"blob_mime"`
Error *SynthError `json:"error"`
URL string `json:"url"`
Status string `json:"status"`
RootFields common.MapStr `json:"root_fields"`
Type string `json:"type"`
PackageVersion string `json:"package_version"`
Step *Step `json:"step"`
Journey *Journey `json:"journey"`
TimestampEpochMicros float64 `json:"@timestamp"`
Payload common.MapStr `json:"payload"`
Blob string `json:"blob"`
BlobMime string `json:"blob_mime"`
Error *SynthError `json:"error"`
URL string `json:"url"`
Status string `json:"status"`
RootFields common.MapStr `json:"root_fields"`
index int
}

Expand Down
49 changes: 25 additions & 24 deletions x-pack/heartbeat/monitors/browser/synthexec/synthtypes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ package synthexec

import (
"encoding/json"
"github.com/elastic/beats/v7/heartbeat/monitors/wrappers"
"net/url"
"testing"
"time"

"github.com/elastic/beats/v7/heartbeat/monitors/wrappers"

"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/go-lookslike"
"github.com/elastic/go-lookslike/testslike"
Expand All @@ -36,7 +37,7 @@ func TestToMap(t *testing.T) {
{
"root fields with URL",
common.MapStr{
"type": "journey/start",
"type": "journey/start",
"package_version": "1.2.3",
"root_fields": map[string]interface{}{
"synthetics": map[string]interface{}{
Expand All @@ -48,21 +49,21 @@ func TestToMap(t *testing.T) {
},
common.MapStr{
"synthetics": common.MapStr{
"type": "journey/start",
"type": "journey/start",
"package_version": "1.2.3",
"nested": "v1",
"nested": "v1",
},
"url": wrappers.URLFields(testUrl),
"url": wrappers.URLFields(testUrl),
"truly_at_root": "v2",
},
},
{
"root fields, step metadata",
common.MapStr{
"type": "step/start",
"type": "step/start",
"package_version": "1.2.3",
"journey": common.MapStr{"name": "MyJourney", "id": "MyJourney"},
"step": common.MapStr{"name": "MyStep", "status": "success", "index": 42},
"journey": common.MapStr{"name": "MyJourney", "id": "MyJourney"},
"step": common.MapStr{"name": "MyStep", "status": "success", "index": 42},
"root_fields": map[string]interface{}{
"synthetics": map[string]interface{}{
"nested": "v1",
Expand All @@ -72,42 +73,42 @@ func TestToMap(t *testing.T) {
},
common.MapStr{
"synthetics": common.MapStr{
"type": "step/start",
"type": "step/start",
"package_version": "1.2.3",
"nested": "v1",
"journey": common.MapStr{"name": "MyJourney", "id": "MyJourney"},
"step": common.MapStr{"name": "MyStep", "status": "success", "index": 42},
"nested": "v1",
"journey": common.MapStr{"name": "MyJourney", "id": "MyJourney"},
"step": common.MapStr{"name": "MyStep", "status": "success", "index": 42},
},
"truly_at_root": "v2",
},
},
{
"weird error, and blob, no URL",
common.MapStr{
"type": "someType",
"type": "someType",
"package_version": "1.2.3",
"journey": common.MapStr{"name": "MyJourney", "id": "MyJourney"},
"step": common.MapStr{"name": "MyStep", "index": 42, "status": "down"},
"journey": common.MapStr{"name": "MyJourney", "id": "MyJourney"},
"step": common.MapStr{"name": "MyStep", "index": 42, "status": "down"},
"error": common.MapStr{
"name": "MyErrorName",
"name": "MyErrorName",
"message": "MyErrorMessage",
"stack": "MyErrorStack",
"stack": "MyErrorStack",
},
"blob": "ablob",
"blob": "ablob",
"blob_mime": "application/weird",
},
common.MapStr{
"synthetics": common.MapStr{
"type": "someType",
"type": "someType",
"package_version": "1.2.3",
"journey": common.MapStr{"name": "MyJourney", "id": "MyJourney"},
"step": common.MapStr{"name": "MyStep", "index": 42, "status": "down"},
"journey": common.MapStr{"name": "MyJourney", "id": "MyJourney"},
"step": common.MapStr{"name": "MyStep", "index": 42, "status": "down"},
"error": common.MapStr{
"name": "MyErrorName",
"name": "MyErrorName",
"message": "MyErrorMessage",
"stack": "MyErrorStack",
"stack": "MyErrorStack",
},
"blob": "ablob",
"blob": "ablob",
"blob_mime": "application/weird",
},
},
Expand Down

0 comments on commit cba9081

Please sign in to comment.