-
Notifications
You must be signed in to change notification settings - Fork 32
Begin building a common compliance test suite. #13
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
Merged
Changes from 23 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
1624c34
Add TODOs for pending implementation items.
robshakir fc69bd1
Merge branch 'main' into fluent-3
robshakir 6a60a6a
Merge branch 'fluent-2' into fluent-3
robshakir fef7d0d
Merge branch 'fluent-2' into fluent-3
robshakir 4baeb2e
Merge branch 'main' into fluent-3
robshakir fba20a0
Restructure client queues to store more context.
robshakir b781f32
Align fluent API for connections with design document.
robshakir cedba58
Merge branch 'dd0' into fluent-4
robshakir 5dcd922
Working commit.
robshakir 7951ba7
Refactoring queueing in client.
robshakir 489445e
Fix client channels, add server election, and chk lib.
robshakir 7c60d2a
Fix up go.mod.
robshakir 30c7db4
Ensure we handle nil parameters correctly.
robshakir 59a3b58
Fix erroneous client behaviour test.
robshakir f8f6ef4
Align with style guide, and remove race tests for fluent.
robshakir 8b404af
Fix workflow syntax.
robshakir 663891b
Update comment
robshakir ca12049
Debug CI.
robshakir c9ff49b
Debug CI.
robshakir c5fadd4
Update workflows for race.
robshakir 0876862
Add handling of SessionParameter negotiation
robshakir 6175a76
Add support for persisting entries to client.
robshakir ed12d4b
Create compliance test library, add error check support
robshakir de27072
Merge branch 'main' into fluent-5
robshakir 2ddd3d6
Merge branch 'fluent-5' into fluent-6
robshakir 65c136f
Merge branch 'fluent-6' into fluent-7
robshakir 25aebc3
Address review comments.
robshakir af0c195
Remove documentation from expectation of race testing.
robshakir d1f0ebd
Merge branch 'fluent-5' into fluent-6
robshakir 69d1688
Merge branch 'main' into fluent-6
robshakir eab2130
Merge branch 'fluent-6' into fluent-7
robshakir 84a98eb
Fix synchronisation issues in client.
robshakir a35d365
Address review comments.
robshakir af4c1fd
Merge branch 'main' into fluent-7
robshakir d77f3bc
Fix merge errors.
robshakir 6242f23
Debug tests on GH Actions.
robshakir 9fb7484
Check whether flakes are due to timing.
robshakir 3364b31
Based on timing, check call order.
robshakir 6fa54eb
Add temporary instrumentation to client.
robshakir e4b4b58
Change approach to checking for convergenceD
robshakir 63d665d
Restructure order of operations to avoid premature converged signal.
robshakir c92a12c
Make writes to the modifyCh blocking.
robshakir 9ca9c71
Avoid a test deadlock.
robshakir 90a9988
adopt atomic.Bool in all cases we signal between goroutines.
robshakir baa35a4
Debug flaky test on GitHub Actions.
robshakir 232e207
Remove debugging statements.
robshakir e779b59
remove debug workflow, clean up comments.
robshakir c178604
Address review comments.
robshakir 5c6e5d3
Fix tests.
robshakir 1d72c92
Fix typo.
robshakir d1d79d8
Merge branch 'main' into fluent-7
robshakir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // Package chk implements checks against the gRIBI client return values, it can be | ||
| // used to determine whether there are expected results within a specific set of return | ||
| // values. | ||
| package chk | ||
|
|
||
| import ( | ||
| "github.com/openconfig/gribigo/client" | ||
| "google.golang.org/grpc/status" | ||
| "google.golang.org/protobuf/proto" | ||
| ) | ||
|
|
||
| // HasElectionID returns true if the result queue supplied contains an update with the election ID | ||
| // with the value of the uint128{low,high} value specified. | ||
| func HasElectionID(res []*client.OpResult, low, high uint64) bool { | ||
| for _, r := range res { | ||
| if v := r.CurrentServerElectionID; v != nil { | ||
| if v.High == high && v.Low == low { | ||
| return true | ||
| } | ||
| } | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| // HasSuccessfulSessionParams checks whether the res results array contains a session parameters | ||
| // result that is successful. | ||
| func HasSuccessfulSessionParams(res []*client.OpResult) bool { | ||
| for _, r := range res { | ||
| if v := r.SessionParameters; v != nil { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| // HasRecvClientErrorWithStatus checks whether the supplied ClientErr ce containa status with | ||
| // the code and details set to the values supplied in want. | ||
| func HasRecvClientErrorWithStatus(ce *client.ClientErr, want *status.Status) bool { | ||
| for _, e := range ce.Recv { | ||
| s, ok := status.FromError(e) | ||
| if !ok { | ||
| continue | ||
| } | ||
| ns := s.Proto() | ||
| ns.Message = "" // blank out message so that we don't compare it. | ||
| if proto.Equal(ns, want.Proto()) { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| package chk | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/openconfig/gribigo/client" | ||
|
|
||
| spb "github.com/openconfig/gribi/v1/proto/service" | ||
| ) | ||
|
|
||
| func TestHasElectionID(t *testing.T) { | ||
| tests := []struct { | ||
| desc string | ||
| inResult []*client.OpResult | ||
| inLow uint64 | ||
| inHigh uint64 | ||
| want bool | ||
| }{{ | ||
| desc: "is present", | ||
| inResult: []*client.OpResult{{ | ||
| CurrentServerElectionID: &spb.Uint128{ | ||
| High: 0, | ||
| Low: 42, | ||
| }, | ||
| }}, | ||
| inLow: 42, | ||
| inHigh: 0, | ||
| want: true, | ||
| }, { | ||
| desc: "is not present", | ||
| inResult: []*client.OpResult{}, | ||
| }} | ||
|
|
||
| for _, tt := range tests { | ||
| if got, want := HasElectionID(tt.inResult, tt.inLow, tt.inHigh), tt.want; got != want { | ||
| t.Errorf("%s: HasElectionDI(%s, %d, %d): did not get expected result, got: %v, want: %v", tt.desc, tt.inResult, tt.inLow, tt.inHigh, got, want) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| func TestHasSuccessfulSessionParams(t *testing.T) { | ||
| tests := []struct { | ||
| desc string | ||
| inResult []*client.OpResult | ||
| want bool | ||
| }{{ | ||
| desc: "is present", | ||
| inResult: []*client.OpResult{{ | ||
| SessionParameters: &spb.SessionParametersResult{}, | ||
| }}, | ||
| want: true, | ||
| }, { | ||
| desc: "is not present", | ||
| inResult: []*client.OpResult{}, | ||
| }} | ||
|
|
||
| for _, tt := range tests { | ||
| if got, want := HasSuccessfulSessionParams(tt.inResult), tt.want; got != want { | ||
| t.Errorf("%s: HasSuccessfulSessionParams(%s): did not get expected result, got: %v, want: %v", tt.desc, tt.inResult, got, want) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.