Skip to content

[SDKS-120]: Read Only Cluster - #94

Merged
mmelograno merged 3 commits into
feature/RedisSentinelSupportfrom
bug/ReadOnlyCluster
Aug 22, 2018
Merged

mmelograno merged 3 commits into
feature/RedisSentinelSupportfrom
bug/ReadOnlyCluster

Conversation

@mmelograno

@mmelograno mmelograno commented Aug 21, 2018 •

Copy link
Copy Markdown
Contributor

SDKS-120: SDK returns control when unable to write the impression back to Redis

  • Removed unnecessary code for segments in redis mode.
  • Added test for read only cluster.
  • Commented unnecessary tests.

self.a_segment_cache.get_registered_segments())
self.some_redis.smembers.assert_called_once_with('SPLITIO.segments.registered')

def test_add_keys_to_segment_adds_keys_to_segment_set(self):

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.

i think these test should work, only registere/unregister segment operations are deprecated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

wrong assumption, I will add it again

'SPLITIO.segment.some_segment_name', self.some_segment_keys[0],
self.some_segment_keys[1])

def test_remove_keys_from_segment_remove_keys_from_segment_set(self):

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.

same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll add it again

'SPLITIO.segment.some_segment_name', self.some_segment_keys[0],
self.some_segment_keys[1])

def test_is_in_segment_tests_whether_a_key_is_in_a_segments_key_set(self):

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.

same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll add it again

self.some_redis.sismember.assert_called_once_with(
'SPLITIO.segment.some_segment_name', self.some_key)

def test_set_change_number_sets_segment_change_number_key(self):

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.

same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added again

self.some_redis.set.assert_called_once_with(
'SPLITIO.segment.some_segment_name.till', self.some_change_number)

def test_get_change_number_gets_segment_change_number_key(self):

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.

same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added

self.some_redis.get.assert_called_once_with(
'SPLITIO.segment.some_segment_name.till')

def test_get_change_number_returns_default_value_if_not_set(self):

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.

same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added

self.fake_id_not_in_segment, 'test_killed'))


class LocalhostEnvironmentClientParseSplitFileTests(TestCase, MockUtilsMixin):

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.

these tests fail because there's a .split file missing in localhost, for some reason it's not being mocked correctly and it looks for that file on the user's home. This is an old flakey test, not introduced by your code. We can work together to fix this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mocked thread for these tests

@mmelograno
mmelograno requested a review from mredolatti August 21, 2018 17:36
@mmelograno

Copy link
Copy Markdown
Contributor Author

@mredolatti code updated regarding the suggestions made

@mredolatti mredolatti 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!

Comment thread splitio/redis_support.py
RedisSegmentCache._KEY_TEMPLATE.format(suffix='registered'),
segment_name
)
# self._redis.sadd(

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.

If everything works properly and QOS is green, we should remember to remove these lines before the final merge to master/release to pypi and just leave a comment # NOTE: segments needn't be registered/unregistered by the sdk when running in redis consumer mode. These operations are handled by the split-synchronizer (link to the split-sync docs)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sounds good

Comment thread splitio/redis_support.py
:type segment_name: str
'''
self._redis.srem(
RedisSegmentCache._KEY_TEMPLATE.format(suffix='registered'),

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.

same as above

@mmelograno mmelograno changed the title [SDK-120]: Read Only Cluster [SDKS-120]: Read Only Cluster Aug 21, 2018
@mmelograno
mmelograno changed the base branch from development to feature/RedisSentinelSupport August 22, 2018 23:02
@mmelograno
mmelograno merged commit 59daa18 into feature/RedisSentinelSupport Aug 22, 2018
@mmelograno
mmelograno deleted the bug/ReadOnlyCluster branch September 4, 2018 20:33
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

⌂ Proxy