Skip to content

Removed sending data to the server in case of load - #184

Merged
dmercuriali merged 3 commits into
masterfrom
fix/remove-data-load-message
Aug 29, 2022
Merged

dmercuriali merged 3 commits into
masterfrom
fix/remove-data-load-message

Conversation

@hamadodene

@hamadodene hamadodene commented Aug 24, 2022 •

Copy link
Copy Markdown
Contributor

Removed sending data to the server in case of load.
In case of load, on the server side, the data is not necessary as it is never used.

@eolivelli eolivelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

please note that this is a wire protocol change.
but the "old" server did not use the "data" field, so the new client is still backward compatible with old servers

@eolivelli

Copy link
Copy Markdown
Contributor

I kindly suggest to add test cases to cover this changes and the protocol.
We only have end-to-end tests, and it will be super easy to break the protocol and the behaviour without tests

@hamadodene
hamadodene force-pushed the fix/remove-data-load-message branch from a8927b5 to 72a6295 Compare August 24, 2022 12:57
@hamadodene

Copy link
Copy Markdown
Contributor Author

@eolivelli @dmercuriali I added a new class RequestParametersTest where I text the message format of requests of type PUT, LOAD, INVALID AND FETCH

@hamadodene
hamadodene force-pushed the fix/remove-data-load-message branch 2 times, most recently from 4a8f70a to 307aa02 Compare August 24, 2022 13:03
@hamadodene
hamadodene force-pushed the fix/remove-data-load-message branch from 307aa02 to ab2cd26 Compare August 24, 2022 13:05
client.setInternalClientListener(new InternalClientListener() {
@Override
public void onRequestSent(Message message) {
assertTrue(message.type == Message.TYPE_PUT_ENTRY);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: assertEquals ?

assertTrue(message.type == Message.TYPE_PUT_ENTRY);
assertTrue(message.parameters.get("data") != null);
assertTrue(message.parameters.get("key") != null);
assertTrue(message.parameters.get("expiretime") != null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also validate the number of entries. To test that there is nothing more that what is expected

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for expiretime we can at least verify the type

public void onRequestSent(Message message) {
assertTrue(message.type == Message.TYPE_PUT_ENTRY);
assertTrue(message.parameters.get("data") != null);
assertTrue(message.parameters.get("key") != null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we know the key, we can use assertEquals

@Override
public void onRequestSent(Message message) {
assertTrue(message.type == Message.TYPE_PUT_ENTRY);
assertTrue(message.parameters.get("data") != null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we know the payload, we can use assertEquals

@hamadodene

Copy link
Copy Markdown
Contributor Author

@dmercuriali @eolivelli PTAL

@aluccaroni
aluccaroni requested a review from dmercuriali August 25, 2022 08:43
@dmercuriali
dmercuriali merged commit 3245ebf into master Aug 29, 2022
@dmercuriali
dmercuriali deleted the fix/remove-data-load-message branch August 29, 2022 17:53
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.

3 participants