Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mshamota-nr committed Oct 22, 2020
1 parent faf3b73 commit 084a7ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions record/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ func RemapRecord(inputRecord FluentBitRecord, inputTimestamp interface{}, plugin
if !ok {
source = "BARE-METAL"
}
_, ok = outputRecord["plugin"]
if !ok {
if _, ok = outputRecord["plugin"]; !ok {
outputRecord["plugin"] = map[string]string{
"type": "fluent-bit",
"version": pluginVersion,
Expand Down
10 changes: 5 additions & 5 deletions record/record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ var _ = Describe("Out New Relic", func() {
time.Now(),
}
expectedType := "something"
pluginMapIn := make(map[string]string)
pluginMapIn["type"] = expectedType
inputMap["plugin"] = pluginMapIn
inputMap["plugin"] = map[string]string{
"type": expectedType,
}
foundOutput := RemapRecord(inputMap, inputTimestamp, pluginVersion)
pluginMap := foundOutput["plugin"].(map[string]string)
Expect(pluginMap["type"]).To(Equal(expectedType))
Expand Down Expand Up @@ -102,7 +102,7 @@ var _ = Describe("Out New Relic", func() {

It("Correctly handles a JSON array in a []interface{}", func() {
// Given
inputRecord := map[interface{}]interface{}{
inputMap := map[interface{}]interface{}{
"nestedArray": []interface{}{
map[interface{}]interface{}{
"stringField": "value1",
Expand All @@ -116,7 +116,7 @@ var _ = Describe("Out New Relic", func() {
}

// When
foundOutput := parseRecord(inputRecord)
foundOutput := parseRecord(inputMap)

// Then
expectedOutput := map[string]interface{}{
Expand Down

0 comments on commit 084a7ff

Please sign in to comment.