-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
241 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
package otlp_test | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
|
@@ -413,3 +414,75 @@ func transformResourceMetadata(t *testing.T, resourceAttrs map[string]interface{ | |
(*events)[0].Timestamp = 0 | ||
return (*events)[0] | ||
} | ||
|
||
type userField struct { | ||
userID string | ||
userName string | ||
userEmail string | ||
} | ||
|
||
type userFieldsTestCase struct { | ||
name string | ||
processOwner string | ||
input userField | ||
expected userField | ||
} | ||
|
||
func userFieldsTestCases() []userFieldsTestCase { | ||
return []userFieldsTestCase{ | ||
{ | ||
name: "default", | ||
input: userField{ | ||
userID: "123", | ||
userName: "hello", | ||
userEmail: "[email protected]", | ||
}, | ||
expected: userField{ | ||
userID: "123", | ||
userName: "hello", | ||
userEmail: "[email protected]", | ||
}, | ||
}, | ||
{ | ||
name: "process owner not overwritten", | ||
processOwner: "i-am-the-owner", | ||
input: userField{ | ||
userID: "123", | ||
userName: "", | ||
userEmail: "[email protected]", | ||
}, | ||
expected: userField{ | ||
userID: "123", | ||
userName: "i-am-the-owner", | ||
userEmail: "[email protected]", | ||
}, | ||
}, | ||
{ | ||
name: "overwrite process owner", | ||
processOwner: "i-am-the-owner", | ||
input: userField{ | ||
userID: "123", | ||
userName: "hello", | ||
userEmail: "[email protected]", | ||
}, | ||
expected: userField{ | ||
userID: "123", | ||
userName: "hello", | ||
userEmail: "[email protected]", | ||
}, | ||
}, | ||
{ | ||
name: "truncate", | ||
input: userField{ | ||
userID: strings.Repeat("a", 2000), | ||
userName: strings.Repeat("b", 2000), | ||
userEmail: strings.Repeat("c", 2000), | ||
}, | ||
expected: userField{ | ||
userID: strings.Repeat("a", 1024), | ||
userName: strings.Repeat("b", 1024), | ||
userEmail: strings.Repeat("c", 1024), | ||
}, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters