-
Notifications
You must be signed in to change notification settings - Fork 41
Add test that validates fingerprint.StartsWith when read from files #145
Add test that validates fingerprint.StartsWith when read from files #145
Conversation
@@ -212,4 +214,49 @@ func TestFingerprintStartsWith(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestFingerprintStartsWith_FromFile(t *testing.T) { | |||
rand.Seed(112358) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This global may not work well if tests are run in parallel (do we?).
r := rand.New(rand.NewSource(112358))
and using r.Read()
should be safer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Fixed.
@@ -212,4 +214,49 @@ func TestFingerprintStartsWith(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestFingerprintStartsWith_FromFile(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not familiar with what the fingerprints and how they work so I don't understand what this test does. Perhaps that's fine and I am not supposed to understand. If you want me to understand though please add some comments to explain what it does :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's certainly not meant to be a secret. :)
I expanded the comments on the Fingerprint
struct and its StartsWith
method, and also added a high level explanation on the new test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the comments, very helpful.
* Add test that validates fingerprint.StartsWith when read from files, from open-telemetry/opentelemetry-log-collection#145 * close files in fingerprint test: https://github.com/observIQ/opentelemetry-log-collection/commit/42931ada82ef26fde2c6e62e6fa9495997bee2cd\#diff-73ecab0b12cec8730ffb8cc5a54d0d1468d7b8c1f2be318a481490402deacc30
No description provided.