-
Notifications
You must be signed in to change notification settings - Fork 5
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
Initial testing PR #25
Conversation
…en tests and test generator. Change content type to zero to match rust code. Signed-off-by: John 9e9 <[email protected]>
Signed-off-by: John 9e9 <[email protected]>
Signed-off-by: John 9e9 <[email protected]>
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.
Thanks a lot for adding all this 🤩
Let's start a discussion for the review. On a high-level view, this PR adds:
- a Rust tool crate to generate JSON test cases from
NativeOperation
,NativeResult
and their serialisations - Go test files checking that for each operation, the correct serialisation/deserialisation happens correctly on both dorection
- Some adjustments to the wire protocol
- Tests on the wire protocol header (de)serialisation
- Tests on the authenticators and the (de)serialisation of the ID
Is that correct? Feel free to add more independant categories if I missed things.
1 and 2 seem to be the big pieces which might need more discussion. The rest seems to be easier to review and get merged. Where I want to go is that if we come with things in this PR that are independant with 1 and 2, perhaps you could send a separate PR for those, which we first agree and merge. Then we can focus the discussion on the meaty stuff!
# - name: Upload Coverage report to CodeCov | ||
# uses: codecov/[email protected] | ||
# with: | ||
# token: ${{secrets.CODECOV_TOKEN}} | ||
# file: ./coverage.txt |
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.
@ionut-arm has been enabling code coverage on multiple of our repos recently, so I guess we could do it here as well now 😃
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.
yes, that'd be good if somebody could sign up with codecov.io account for the project, get a token then make it available.
I have it on my fork, but have disabled it for the PR as it causes the build to fail without the secret set.
Will create an issue for it.
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.
have created #27
.gitignore
Outdated
@@ -1,3 +1,4 @@ | |||
node_modules | |||
.vscode | |||
... | |||
test-notes.md |
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.
Is it a file generated during the test process?
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.
nope, good spot, that was a file i was keeping track of the tests with.... will remove
provider: requests.ProviderCore, | ||
authType: auth.AuthUnixPeerCredentials, |
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.
In the future, I guess those two fields will be computed via #6 ?
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.
yes they would
@@ -522,6 +528,8 @@ func (c Client) operation(op requests.OpCode, provider requests.ProviderID, requ | |||
if err != nil { | |||
return err | |||
} | |||
// TODO ensure that we continue writing whole buffer afer a short write | |||
// https://github.com/parallaxsecond/parsec-client-go/issues/23 |
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.
As in the following call is asynchronous? It would be possible for it to return successfully when not all the b.Bytes()
have been written?
Is it possible to make it fully blocking at first?
type TestCase struct { | ||
Name string `json:"name"` | ||
RequestData interface{} `json:"request_data"` | ||
ExpectedRequestBinary string `json:"expected_request_binary"` | ||
ResponseBinary string `json:"response_binary"` | ||
ExpectedResponseData interface{} `json:"expected_response"` | ||
ExpectSuccess bool `json:"expect_success"` | ||
} |
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.
Just for my understanding, with those tests you check that the stack correctly performs the conversions:
- from high-level functions with specific parameters (in
RequestData
) to binary data transmitted - from the binary response to the high-level functions return value
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.
yes, that's correct, but a comment would be a good idea ;)
@@ -37,3 +35,7 @@ const ( | |||
OpPsaVerifyMessage OpCode = 0x0019 | |||
OpListKeys OpCode = 0x001A |
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.
Maybe we need a warning notice here, or a test of some sort, to also modify the IsValid
method is an opcode bigger than the biggest one is added.
Same for all the IsValid
methods 😬
|
Signed-off-by: John 9e9 <[email protected]>
Did wonder if the test data generator (and the test data) would be best in the parsec-interface-rs repo or its own. We could either do it now, or wait until I've done a lump more testing and see how it evolves first? |
That sounds good!
That is an interesting question... Let's open that one on the community channel to see what everyone thinks. |
See the linked issue for a proposal 😸 If you can set aside a few hours to read it |
going to close this as will be ote with acceptance/implementation of this: https://github.com/parallaxsecond/parsec/issues/350 Retaining branch on fork for reference |
Add low level interface tests. Add initial operation client data driven tests and test generator.
Change content type to zero to match rust code.
Partial completion of #12
Signed-off-by: John 9e9 [email protected]