Skip to content

Add samples for Redis Labs redis for standard py37#1628

Merged
andrewsg merged 1 commit intoGoogleCloudPlatform:masterfrom
andrewsg:redis
Aug 16, 2018
Merged

Add samples for Redis Labs redis for standard py37#1628
andrewsg merged 1 commit intoGoogleCloudPlatform:masterfrom
andrewsg:redis

Conversation

@andrewsg
Copy link
Copy Markdown
Member

No description provided.

@andrewsg andrewsg requested a review from ace-n August 10, 2018 22:58
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 10, 2018
Copy link
Copy Markdown

@ace-n ace-n left a comment

Choose a reason for hiding this comment

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

LGTM once nits are addressed.


# [START gae_py37_redis_client]
redis_host = os.environ.get('REDIS_HOST', 'localhost')
redis_port = int(os.environ.get('REDIS_PORT', 6379))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: will this fail [gracefully] if REDIS_PORT is set to a non-integer?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It'll fail with an exception that shows pretty clearly what the problem is, which is the best we can ask for given there is no way to operate without that number.


r = client.get('/')
assert r.status_code == 200
assert '1' in r.data.decode('utf-8')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: what is the format of r.data? Is there any chance of spurious 1s or 2s occurring in it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, this test is copied from Flex and we didn't have any issues. The format is an integer but it'll be starting from zero every time, and the feature that determines that is not a component under test.

@andrewsg andrewsg merged commit 603bfc0 into GoogleCloudPlatform:master Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants