Skip to content
Merged
Show file tree
Hide file tree
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 Jun 2, 2021
fc69bd1
Merge branch 'main' into fluent-3
robshakir Jun 2, 2021
6a60a6a
Merge branch 'fluent-2' into fluent-3
robshakir Jun 2, 2021
fef7d0d
Merge branch 'fluent-2' into fluent-3
robshakir Jun 2, 2021
4baeb2e
Merge branch 'main' into fluent-3
robshakir Jun 2, 2021
fba20a0
Restructure client queues to store more context.
robshakir Jun 3, 2021
b781f32
Align fluent API for connections with design document.
robshakir Jun 3, 2021
cedba58
Merge branch 'dd0' into fluent-4
robshakir Jun 3, 2021
5dcd922
Working commit.
robshakir Jun 4, 2021
7951ba7
Refactoring queueing in client.
robshakir Jun 5, 2021
489445e
Fix client channels, add server election, and chk lib.
robshakir Jun 5, 2021
7c60d2a
Fix up go.mod.
robshakir Jun 5, 2021
30c7db4
Ensure we handle nil parameters correctly.
robshakir Jun 5, 2021
59a3b58
Fix erroneous client behaviour test.
robshakir Jun 5, 2021
f8f6ef4
Align with style guide, and remove race tests for fluent.
robshakir Jun 5, 2021
8b404af
Fix workflow syntax.
robshakir Jun 5, 2021
663891b
Update comment
robshakir Jun 5, 2021
ca12049
Debug CI.
robshakir Jun 5, 2021
c9ff49b
Debug CI.
robshakir Jun 5, 2021
c5fadd4
Update workflows for race.
robshakir Jun 5, 2021
0876862
Add handling of SessionParameter negotiation
robshakir Jun 6, 2021
6175a76
Add support for persisting entries to client.
robshakir Jun 6, 2021
ed12d4b
Create compliance test library, add error check support
robshakir Jun 6, 2021
de27072
Merge branch 'main' into fluent-5
robshakir Jun 7, 2021
2ddd3d6
Merge branch 'fluent-5' into fluent-6
robshakir Jun 7, 2021
65c136f
Merge branch 'fluent-6' into fluent-7
robshakir Jun 7, 2021
25aebc3
Address review comments.
robshakir Jun 7, 2021
af0c195
Remove documentation from expectation of race testing.
robshakir Jun 7, 2021
d1f0ebd
Merge branch 'fluent-5' into fluent-6
robshakir Jun 7, 2021
69d1688
Merge branch 'main' into fluent-6
robshakir Jun 7, 2021
eab2130
Merge branch 'fluent-6' into fluent-7
robshakir Jun 7, 2021
84a98eb
Fix synchronisation issues in client.
robshakir Jun 7, 2021
a35d365
Address review comments.
robshakir Jun 7, 2021
af4c1fd
Merge branch 'main' into fluent-7
robshakir Jun 7, 2021
d77f3bc
Fix merge errors.
robshakir Jun 7, 2021
6242f23
Debug tests on GH Actions.
robshakir Jun 7, 2021
9fb7484
Check whether flakes are due to timing.
robshakir Jun 7, 2021
3364b31
Based on timing, check call order.
robshakir Jun 7, 2021
6fa54eb
Add temporary instrumentation to client.
robshakir Jun 7, 2021
e4b4b58
Change approach to checking for convergenceD
robshakir Jun 7, 2021
63d665d
Restructure order of operations to avoid premature converged signal.
robshakir Jun 7, 2021
c92a12c
Make writes to the modifyCh blocking.
robshakir Jun 7, 2021
9ca9c71
Avoid a test deadlock.
robshakir Jun 7, 2021
90a9988
adopt atomic.Bool in all cases we signal between goroutines.
robshakir Jun 8, 2021
baa35a4
Debug flaky test on GitHub Actions.
robshakir Jun 8, 2021
232e207
Remove debugging statements.
robshakir Jun 8, 2021
e779b59
remove debug workflow, clean up comments.
robshakir Jun 8, 2021
c178604
Address review comments.
robshakir Jun 9, 2021
5c6e5d3
Fix tests.
robshakir Jun 9, 2021
1d72c92
Fix typo.
robshakir Jun 10, 2021
d1d79d8
Merge branch 'main' into fluent-7
robshakir Jun 10, 2021
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
5 changes: 4 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ jobs:
run: go test -v -coverprofile=profile.cov ./...

- name: Race Test
run: go test -race ./...
run: |
for i in `find . -type d -mindepth 1 -maxdepth 1 | egrep -v ".git|.github|fluent"`; do
go test -race ./$i
done

- name: Coveralls
if: ${{ matrix.go == '1.14' }}
Expand Down
51 changes: 51 additions & 0 deletions chk/chk.go
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
}
62 changes: 62 additions & 0 deletions chk/chk_test.go
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)
}
}
}
Loading