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

Idempotent #58

Merged
merged 13 commits into from
Oct 21, 2018
Merged

Idempotent #58

merged 13 commits into from
Oct 21, 2018

Conversation

jdavid
Copy link
Contributor

@jdavid jdavid commented Sep 10, 2018

Not ready for merge as only 1 item is done (TO3n), but prefer to get early feedback.


$body = $channel->__publish_request_body( $msg );
$body = json_decode($body);
$this->assertEquals( $body->id, "foobar" );
Copy link
Member

Choose a reason for hiding this comment

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

This is an inadequate test, why are you not doing a history query as well to check that the outcome is as expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

$id = explode ( ":", $body->id);
$this->assertEquals( count($id), 2);
$this->assertGreaterThanOrEqual( base64_decode($id[0]), 9);
$this->assertEquals( $id[1], "0");
Copy link
Member

Choose a reason for hiding this comment

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

Can you not do a history request to get this info?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

$body = json_decode($body);

$this->assertEquals( $body[0]->id, "foobar" );
$this->assertFalse( property_exists($body[1], 'id') );
Copy link
Member

Choose a reason for hiding this comment

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

This should fail, you can't mix messages with idempotency and not idempotency, so not sure why this works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't understand. RSL1k3 says If more than one Message is passed to publish() and one or more of those messages contains a non-empty id attribute, then all message ids (present or absent) are preserved on sending the batch of messages.

That's what we're testing. The first message with id, the second without. In line 105 we test the id is sent for th 1st message, in line 106 we test it's not sent for the 2nd message.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, @jdavid from a client SDK perspective, this is true. However, from a realtime perspective, we are meant to reject publishes for batches of messages where one or more messages contain IDs that don't follow the ID format described in RSL1k1. So this is a realtime bug, but I am concerned that once that bug is fixed, these tests will start failing.

Copy link
Member

Choose a reason for hiding this comment

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

@paddybyers see above. Could we implement a quick fix to at least reject those messages for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just run the tests locally and they still pass, so I guess the quick fix has not been implemented?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I've just written a test that sends an identical 2 messages and they get rejected. @jdavid are you testing this against the idempotent-dev environment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@paddybyers yes, in the idempotent branch, since commit 2e04a82

Copy link
Member

Choose a reason for hiding this comment

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

@jdavid ok then, how easy is it for me to get set up to run the tests myself to see what's going on?

@jdavid
Copy link
Contributor Author

jdavid commented Sep 19, 2018

Has idempotent support been dropped from the dev environment?
Because the RSL1k5 test is failing now.

@jdavid
Copy link
Contributor Author

jdavid commented Sep 19, 2018

RSL1k4 done, the PR is complete.

But tests are failing. At least some of the failures are because, apparently, the dev environment doesn't support idempotency anymore.

Seen in Travis:

PHP Warning:  Declaration of tests\HttpMockIdempotent::request($method, ...$args) should be compatible with Ably\Http::request($method, $url, $headers = Array, $params = Array) in /home/travis/build/ably/ably-php/tests/ChannelIdempotentTest.php on line 22
@jdavid
Copy link
Contributor Author

jdavid commented Sep 21, 2018

Tests are green now.

@mattheworiordan I think I've addressed your first 2 comments, but I need clarification on the third one. Otherwise the PR is complete.

@jdavid
Copy link
Contributor Author

jdavid commented Oct 11, 2018

ping

@mattheworiordan
Copy link
Member

@jdavid when you say the third one, I assume you are referring to #58 (comment). If so, I am afraid I am waiting on @paddybyers. I will ping him again too.

@mattheworiordan
Copy link
Member

mattheworiordan commented Oct 17, 2018 via email

@jdavid
Copy link
Contributor Author

jdavid commented Oct 19, 2018

Sorry the test was not actually publishing to the server, now it does and it is rejected.

Now is it good?

@paddybyers
Copy link
Member

Sorry the test was not actually publishing to the server, now it does and it is rejected.
Now is it good?

Looks good to me, thanks

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

Successfully merging this pull request may close these issues.

3 participants