Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GODRIVER-2586 Add log messages to CMAP spec #1165

Merged
merged 111 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
2c4a27f
GODRIVER-2570 initialize the logger package
prestonvasquez Dec 6, 2022
8d67dca
GODRIVER-2570 initialize command logging logic
prestonvasquez Dec 8, 2022
024ed89
GODRIVER-2570 unified spec test first draft
prestonvasquez Dec 14, 2022
20d3638
GODRIVER-2570 initialize unified spec test runner
prestonvasquez Dec 15, 2022
a281a74
GODRIVER-2570 remove panic
prestonvasquez Dec 15, 2022
9069935
GODRIVER-2570 first draft of logging verification proc
prestonvasquez Dec 19, 2022
f6c4903
GODRIVER-2570 clean up verification process
prestonvasquez Dec 21, 2022
e8e2171
GODRIVER-2570 clean up verification logic
prestonvasquez Dec 29, 2022
7e0f49a
GODRIVER-2570 more verification cleanup
prestonvasquez Dec 29, 2022
337b954
GODRIVER-2570 convert is to verify
prestonvasquez Dec 30, 2022
f5f3357
GODRIVER-2570 add waitForEvent to test runner
prestonvasquez Jan 4, 2023
e21f787
GODRIVER-2570 fix heartbeat tests
prestonvasquez Jan 4, 2023
e435f32
GODRIVER-2570 add rw locks to counter
prestonvasquez Jan 5, 2023
62998de
GODRIVER-2570 add redaction logic
prestonvasquez Jan 5, 2023
a4c5c20
GODRIVER-2570 complete adding CLAM spec tests
prestonvasquez Jan 5, 2023
3669a03
GODRIVER-2570 add logic to the standard sink
prestonvasquez Jan 5, 2023
5d5b937
GODRIVER-2570 finish up first prose test
prestonvasquez Jan 6, 2023
d96a313
GODRIVER-2570 add CLAM prose tests
prestonvasquez Jan 9, 2023
cbfc03a
GODRIVER-2570 decouple log test helpers
prestonvasquez Jan 9, 2023
7adf661
GODRIVER-2570 add logging examples
prestonvasquez Jan 10, 2023
e6018d1
GODRIVER-2570 clean up components
prestonvasquez Jan 11, 2023
f6c8117
GODRIVER-2570 remove 2
prestonvasquez Jan 11, 2023
78f11cb
GODRIVER-2570 cleanup comments and unecessary logic
prestonvasquez Jan 11, 2023
297686d
GODRIVER-2570 remove empty tests
prestonvasquez Jan 11, 2023
436fa9b
GODRIVER-2570 move duration to the info struct
prestonvasquez Jan 11, 2023
2840b5a
GODRIVER-2570 resolve merge conflict
prestonvasquez Jan 11, 2023
f5932fd
GODRIVER-2570 chore up prose tests
prestonvasquez Jan 12, 2023
8a09cd9
GODRIVER-2570 fix linting errors
prestonvasquez Jan 12, 2023
9d2b7ed
GODRIVER-2570 put a hold on prose test #3
prestonvasquez Jan 12, 2023
419c525
GODRIVER-2570 remove empty tests
prestonvasquez Jan 12, 2023
88e2668
GODRIVER-2570 fix < 4.0 failures
prestonvasquez Jan 12, 2023
9d5bf42
GODRIVER-2570 defer port parsing to logger
prestonvasquez Jan 12, 2023
c0a6684
GODRIVER-2570 add serverID to LB
prestonvasquez Jan 12, 2023
31ae8a2
GODRIVER-2570 add copyright and fix requests
prestonvasquez Jan 12, 2023
6c426f2
GODRIVER-2570 clean up logger examples
prestonvasquez Jan 12, 2023
2987e8e
GODRIVER-2570 PR revisions
prestonvasquez Jan 13, 2023
ed7b0db
GODRIVER-2570 removve functional logic in logger constructor
prestonvasquez Jan 13, 2023
50fe47f
GODRIVER-2570 reverse changes to err bufferSize
prestonvasquez Jan 13, 2023
d7e9309
GODRIVER-2570 PR revisions
prestonvasquez Jan 13, 2023
7853321
GODRIVER-2570 fix static analysis errors
prestonvasquez Jan 14, 2023
6bbc09e
GODRIVER-2570 synchronize logger print
prestonvasquez Jan 17, 2023
859df67
GODRIVER-2586 initial implementation
prestonvasquez Jan 19, 2023
ccc25e7
GODRIVER-2570 PR revisions
prestonvasquez Jan 19, 2023
5e6d187
GODRIVER-2570 fix typos in logger examples
prestonvasquez Jan 19, 2023
e4d152a
GODRIVER-2586 resolves merge conflicts
prestonvasquez Jan 19, 2023
a0d49c6
GODRIVER-2586 start adding wait queue
prestonvasquez Jan 20, 2023
7d51efa
GODRIVER-2570 fix failng tests; PR revisions
prestonvasquez Jan 20, 2023
dfcfad8
GODRIVER-2570 remove assertion test
prestonvasquez Jan 20, 2023
a2817bc
GODRIVER-2570 add a test for the truncate routine
prestonvasquez Jan 20, 2023
f0aff05
GODRIVER-2570 add third CLAM prose test
prestonvasquez Jan 20, 2023
fc2511e
GODRIVER-2570 clean up error handlingin prose test
prestonvasquez Jan 20, 2023
d80e7ee
GODRIVER-2570 clean up prose tests:
prestonvasquez Jan 20, 2023
16f3d3b
Merge branch 'GODRIVER-2570' into GODRIVER-2586
prestonvasquez Jan 20, 2023
5a82345
GODRIVER-2570 PR revisions
prestonvasquez Jan 23, 2023
c00f4b0
GODRIVER-2570 move Command to the component.go file
prestonvasquez Jan 23, 2023
5338b31
GODRIVER-2570 rename osSink to IOSink
prestonvasquez Jan 24, 2023
5c05825
Merge branch 'GODRIVER-2570' into GODRIVER-2586
prestonvasquez Jan 24, 2023
c2e5667
GODRIVER-2586 start formatting pool created message
prestonvasquez Jan 24, 2023
55d5e3a
GODRIVER-2570 fix logger tests
prestonvasquez Jan 24, 2023
edb7a07
Merge branch 'GODRIVER-2570' into GODRIVER-2586
prestonvasquez Jan 24, 2023
29b5561
GODRIVER-2586 work through pattern
prestonvasquez Jan 24, 2023
9c9c634
GODRIVER-2570 clean up operation logging
prestonvasquez Jan 24, 2023
8853676
GODRIVER-2586 resolve merge conflicts
prestonvasquez Jan 24, 2023
ac61a0f
GODRIVER-2586 refactor logging validator to subset exected for actual
prestonvasquez Jan 26, 2023
a622d7a
GODRIVER-2570 update PR for revision requests
prestonvasquez Jan 26, 2023
5892d06
GODRIVER-2570 update static analysis errors
prestonvasquez Jan 26, 2023
56e48df
GODRIVER-2570 revert loosened test conditions for logger verification
prestonvasquez Jan 27, 2023
b4156b2
Merge branch 'master' into GODRIVER-2570
prestonvasquez Jan 27, 2023
e97407a
GODRIVER-2586 start working on the io log messages
prestonvasquez Jan 27, 2023
7a5ecee
GODRIVER-2570 add licenses to internal logger files
prestonvasquez Jan 27, 2023
40bbb18
GODRIVER-2570 add a custom log sink example
prestonvasquez Jan 27, 2023
2752a6f
GODRIVER-2586 start working on second set of spec tests
prestonvasquez Jan 27, 2023
7e6bab6
GODRIVER-2570 clean up filepath logging
prestonvasquez Jan 27, 2023
532b815
GODRIVER-2586 continue with the async pipeline
prestonvasquez Jan 30, 2023
142a1fc
GODRIVER-2570 fix logger test
prestonvasquez Jan 30, 2023
67920bf
GODRIVER-2586 pipe the channel closures
prestonvasquez Jan 30, 2023
cd215a0
GODRIVER-2570 use pipelines for go channels
prestonvasquez Jan 30, 2023
0285a52
GODRIVER-2586 merge 2570 updates
prestonvasquez Jan 30, 2023
666d87a
GODRIVER-2586 add additional client entities
prestonvasquez Jan 31, 2023
af63e5c
GODRIVER-2586 remove the unecessary connection file
prestonvasquez Jan 31, 2023
5c4c3c5
GODRIVER-2589 remove magic strings
prestonvasquez Jan 31, 2023
511d0c1
GODRIVER-2586 update CMAP logging tests
prestonvasquez Feb 1, 2023
1f2cf92
GODRIVER-2586 resolve static analysis failures
prestonvasquez Feb 1, 2023
4395240
GODRIVER-2586 clean up pool errors
prestonvasquez Feb 2, 2023
4dc7657
add ready mutex to wantConn
prestonvasquez Feb 2, 2023
1df2828
GODRIVER-2570 merge ready guard
prestonvasquez Feb 3, 2023
f2c6824
GODRIVER-2688 Misc Updates to Logging
prestonvasquez Feb 3, 2023
7c7eddd
GODRIVER-2688 remove comment
prestonvasquez Feb 3, 2023
506588e
GODRIVER-2688 no service ID if nil
prestonvasquez Feb 3, 2023
283265d
GODRIVER-2586 merge GODRIVER-2688
prestonvasquez Feb 6, 2023
3c88560
GODRIVER-2586 clean up
prestonvasquez Feb 6, 2023
a2a430c
Merge branch 'master' into GODRIVER-2586
prestonvasquez Feb 6, 2023
ad334bf
GODRIVER-2586 clean up the operations
prestonvasquez Feb 7, 2023
466d36f
GODRIVER-2586 fix linting issues
prestonvasquez Feb 7, 2023
c8074b5
GODRIVER-2586 add CMAP log test back
prestonvasquez Feb 7, 2023
38d308f
GODRIVER-2586 account for unordered logs
prestonvasquez Feb 8, 2023
af58883
GODRIVER-2586 clean up logger verification
prestonvasquez Feb 8, 2023
153cece
GODRIVER-2586 fix linting errors
prestonvasquez Feb 8, 2023
2def83d
Delete lb-expansion.yml
prestonvasquez Feb 8, 2023
3589335
GODRIVER-2586 typo fixes
prestonvasquez Feb 9, 2023
c8befe5
Merge branch 'GODRIVER-2586' of github.com:prestonvasquez/mongo-go-dr…
prestonvasquez Feb 9, 2023
2680cae
GODRIVER-2586 resolve PR requests
prestonvasquez Feb 16, 2023
890ffb4
GODRIVER-2586 resolve PR requests
prestonvasquez Feb 17, 2023
9ffc6a7
GODRIVER-2586 add mutex to IOSink enc
prestonvasquez Feb 21, 2023
85a7a65
GODRIVER-2586 add io sink test
prestonvasquez Feb 23, 2023
5e7cbff
GODRIVER-2586 clean up tests
prestonvasquez Feb 24, 2023
e84767f
GODRIVER-2586 remove custom example
prestonvasquez Feb 24, 2023
586f368
GODRIVER-2586 update options example
prestonvasquez Feb 24, 2023
c6152c4
Update mongo/options/example_test.go
prestonvasquez Feb 24, 2023
2d6c406
GODRIVER-2586 add connection pool ready message
prestonvasquez Feb 25, 2023
4773954
Merge branch 'GODRIVER-2586' of github.com:prestonvasquez/mongo-go-dr…
prestonvasquez Feb 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
GODRIVER-2570 convert is to verify
  • Loading branch information
prestonvasquez committed Dec 30, 2022
commit 337b954c19d49fd5685db7d30718ba7c3d57de18
26 changes: 15 additions & 11 deletions mongo/integration/unified/logger_verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,24 @@ func (message *logMessage) validate() error {
return nil
}

// is will check if the "got" logActual argument matches the expectedLogMessage. Note that we do not need to
// compare the component literals, as that can be validated through the messages and arguments.
func (message logMessage) is(ctx context.Context, target *logMessage) error {
if target == nil {
return errLogNotFound
// verifyLogMessagesMatch will verify that the actual log messages match the expected log messages.
func verifyLogMessagesMatch(ctx context.Context, expected, actual *logMessage) error {
if actual == nil && expected == nil {
return nil
}

if actual == nil || expected == nil {
return errLogDocumentMismatch
}

// The levels of the expected log message and the actual log message must match, upto logger.Level.
if message.LevelLiteral.Level() != target.LevelLiteral.Level() {
return fmt.Errorf("%w: want %v, got %v", errLogLevelMismatch, message.LevelLiteral,
target.LevelLiteral)
if expected.LevelLiteral.Level() != actual.LevelLiteral.Level() {
return fmt.Errorf("%w: want %v, got %v", errLogLevelMismatch, expected.LevelLiteral,
actual.LevelLiteral)
}

rawMsg := documentToRawValue(message.Data)
rawTgt := documentToRawValue(target.Data)
rawMsg := documentToRawValue(expected.Data)
rawTgt := documentToRawValue(actual.Data)

if err := verifyValuesMatch(ctx, rawMsg, rawTgt, true); err != nil {
return fmt.Errorf("%w: %v", errLogDocumentMismatch, err)
Expand Down Expand Up @@ -266,7 +269,8 @@ func (validator *logMessageValidator) startWorker(ctx context.Context, clientNam
continue
}

if err := expectedMessage.is(ctx, actual.logMessage); err != nil {
err := verifyLogMessagesMatch(ctx, expectedMessage, actual.logMessage)
if err != nil {
validator.err <- err

continue
Expand Down
5 changes: 3 additions & 2 deletions mongo/integration/unified/logger_verification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ func TestLogMessage(t *testing.T) {
return
}

if err := tcase.want.is(context.Background(), got); err != nil {
err = verifyLogMessagesMatch(context.Background(), tcase.want, got)
if err != nil {
t.Fatalf("newLogMessage = %v, want %v", got, tcase.want)
}
})
Expand Down Expand Up @@ -235,7 +236,7 @@ func TestLogMessage(t *testing.T) {
t.Run(tcase.name, func(t *testing.T) {
t.Parallel()

got := tcase.expected.is(context.Background(), tcase.actual)
got := verifyLogMessagesMatch(context.Background(), tcase.expected, tcase.actual)
for _, err := range tcase.want {
if !errors.Is(got, err) {
t.Errorf("expected error %v, got %v", err, got)
Expand Down