-
Notifications
You must be signed in to change notification settings - Fork 173
colibri: add ctrl structs for requests #3685
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
colibri: add ctrl structs for requests #3685
Conversation
be45fbb
to
0fd3422
Compare
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.
Reviewed 16 of 16 files at r1.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @juagargi)
go/lib/ctrl/colibri_mgmt/colibri_mgmt_test.go, line 31 at r1 (raw file):
} buffer, err := root.PackRoot() if err != nil {
testify/require
require.NoError(t, err)
go/lib/ctrl/colibri_mgmt/colibri_mgmt_test.go, line 35 at r1 (raw file):
} if len(buffer) != 7 { t.Fatalf("Expected 15 bytes, got %d", len(buffer))
require.Len(t, buffer, 7)
go/lib/ctrl/colibri_mgmt/colibri_mgmt_test.go, line 37 at r1 (raw file):
t.Fatalf("Expected 15 bytes, got %d", len(buffer)) } copy, err := colibri_mgmt.NewFromRaw(buffer)
don't shadow go keywords
go/lib/ctrl/colibri_mgmt/colibri_mgmt_test.go, line 48 at r1 (raw file):
t.Fatalf("Error serializing root: %v", err) } if bytes.Compare(buffer, otherBuffer) != 0 {
testify/assert
assert.Equal
go/lib/ctrl/colibri_mgmt/colibri_mgmt_test.go, line 55 at r1 (raw file):
// tests serialization for all types of requests func TestSerializeRequest(t *testing.T) { setup := &colibri_mgmt.SegmentSetup{
this can be a table driven test:
testCases := map[string]struct{
Request *colibri_mgmt.Request
}{
"setup": {
Request: &colibri_mgmt.Request{
Which: proto.Request_Which_segmentSetup,
SegmentSetup: ...
},
},
...
}
for name, tc := range testCases {
name, tc := name, tc
t.Run(name, func(t *testing.T){
t.Parallel()
root := &colibri_mgmt.ColibriRequestPayload{
Which: proto.ColibriRequestPayload_Which_request,
Request: request,
}
// All the code from serializeAndCompareRoot(t, root)
})
}
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.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @oncilla)
go/lib/ctrl/colibri_mgmt/colibri_mgmt_test.go, line 31 at r1 (raw file):
Previously, Oncilla wrote…
testify/require
require.NoError(t, err)
Done.
go/lib/ctrl/colibri_mgmt/colibri_mgmt_test.go, line 35 at r1 (raw file):
Previously, Oncilla wrote…
require.Len(t, buffer, 7)
Done.
go/lib/ctrl/colibri_mgmt/colibri_mgmt_test.go, line 37 at r1 (raw file):
Previously, Oncilla wrote…
don't shadow go keywords
Done.
go/lib/ctrl/colibri_mgmt/colibri_mgmt_test.go, line 48 at r1 (raw file):
Previously, Oncilla wrote…
testify/assert
assert.Equal
Done.
go/lib/ctrl/colibri_mgmt/colibri_mgmt_test.go, line 55 at r1 (raw file):
Previously, Oncilla wrote…
this can be a table driven test:
testCases := map[string]struct{ Request *colibri_mgmt.Request }{ "setup": { Request: &colibri_mgmt.Request{ Which: proto.Request_Which_segmentSetup, SegmentSetup: ... }, }, ... } for name, tc := range testCases { name, tc := name, tc t.Run(name, func(t *testing.T){ t.Parallel() root := &colibri_mgmt.ColibriRequestPayload{ Which: proto.ColibriRequestPayload_Which_request, Request: request, } // All the code from serializeAndCompareRoot(t, root) }) }
Done.
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.
Reviewed 1 of 1 files at r2.
Reviewable status:complete! all files reviewed, all discussions resolved
Fix typos/issues found in requests.
8e031e7
to
f311032
Compare
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.
Reviewed 1 of 1 files at r3.
Reviewable status:complete! all files reviewed, all discussions resolved
Add the corresponding `lib/ctrl/colibri_mgmt` structs for (de)serialization of the capnp messages. Add only those types needed for `colibri_mgmt.Request`. The `Response` type is still pending. Add unit tests to check correct (de)serialization.
Add the corresponding `lib/ctrl/colibri_mgmt` structs for (de)serialization of the capnp messages. Add only those types needed for `colibri_mgmt.Request`. The `Response` type is still pending. Add unit tests to check correct (de)serialization.
Adding the corresponding
lib/ctrl/colibri_mgmt
structs for (de)serialization of the capnp messages.Added only those types needed for
colibri_mgmt.Request
. TheResponse
type is still pending.Added UT to check correct (de)serialization.
After this, still pending before the colibri store:
Response
type.This change is