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

Initial testing PR #25

Closed
wants to merge 4 commits into from
Closed

Initial testing PR #25

wants to merge 4 commits into from

Conversation

jn9e9
Copy link
Collaborator

@jn9e9 jn9e9 commented Feb 24, 2021

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]

…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]>
@ionut-arm ionut-arm self-requested a review February 26, 2021 00:44
Copy link
Member

@hug-dev hug-dev left a 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:

  1. a Rust tool crate to generate JSON test cases from NativeOperation, NativeResult and their serialisations
  2. Go test files checking that for each operation, the correct serialisation/deserialisation happens correctly on both dorection
  3. Some adjustments to the wire protocol
  4. Tests on the wire protocol header (de)serialisation
  5. 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!

Comment on lines +56 to +60
# - name: Upload Coverage report to CodeCov
# uses: codecov/[email protected]
# with:
# token: ${{secrets.CODECOV_TOKEN}}
# file: ./coverage.txt
Copy link
Member

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 😃

Copy link
Collaborator Author

@jn9e9 jn9e9 Mar 1, 2021

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.

Copy link
Collaborator Author

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
Copy link
Member

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?

Copy link
Collaborator Author

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

Comment on lines +89 to +90
provider: requests.ProviderCore,
authType: auth.AuthUnixPeerCredentials,
Copy link
Member

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 ?

Copy link
Collaborator Author

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
Copy link
Member

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?

Comment on lines +52 to +59
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"`
}
Copy link
Member

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

Copy link
Collaborator Author

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
Copy link
Member

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 😬

@jn9e9
Copy link
Collaborator Author

jn9e9 commented Mar 1, 2021

Thanks a lot for adding all this 🤩
Let's start a discussion for the review. On a high-level view, this PR adds:

1. a Rust tool crate to generate JSON test cases from `NativeOperation`, `NativeResult` and their serialisations

2. Go test files checking that for each operation, the correct serialisation/deserialisation happens correctly on both dorection

3. Some adjustments to the wire protocol

4. Tests on the wire protocol header (de)serialisation

5. 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.
Yes, that is about it

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!
OK, I'll see if i can create a new branch and pull the 3-5 changes across and resubmit another PR to cover those.

Signed-off-by: John 9e9 <[email protected]>
@jn9e9
Copy link
Collaborator Author

jn9e9 commented Mar 1, 2021

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?

@hug-dev
Copy link
Member

hug-dev commented Mar 2, 2021

OK, I'll see if i can create a new branch and pull the 3-5 changes across and resubmit another PR to cover those.

That sounds good!

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 is an interesting question... Let's open that one on the community channel to see what everyone thinks.

@hug-dev
Copy link
Member

hug-dev commented Mar 2, 2021

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

@jn9e9
Copy link
Collaborator Author

jn9e9 commented Mar 10, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants