-
Notifications
You must be signed in to change notification settings - Fork 6.6k
[bigtable] Cloud function example #3486
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
Conversation
functions/bigtable/main_test.py
Outdated
bigtable.Client = MagicMock() | ||
|
||
|
||
class TestingRow: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're using your own class. How are you confident on whether bigtable_read_data()
really works with the actual Bigtable service?
Is it difficult to write a test with the real service?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just following the examples of all the other tests that we have. I couldn't figure how to create objects using the existing classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you write a test that acctually access BigTable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Adding more line breaks
functions/bigtable/main_test.py
Outdated
bigtable.Client = MagicMock() | ||
|
||
|
||
class TestingRow: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you write a test that acctually access BigTable?
@tmatsuo tests are fixed and green :) |
@billyjacobson I still see the test with a mock. |
@tmatsuo oops!! I forgot to push, sorry about that |
functions/bigtable/main_test.py
Outdated
import datetime | ||
import os | ||
import uuid | ||
import pytest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytest
is a 3rd party library. Can you do the following
import datetime
import os
import uuid
from google.cloud import bigtable
from requests import Request
import pytest
import main
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see pytest
is in standard library block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I fixed this, but was getting this when pushing which I guess prevented it from going in
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing...
|
||
response = main.bigtable_read_data(request) | ||
|
||
assert """Rowkey: phone#4c410523#20190501, os_build: PQ2A.190405.003 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I'm not sure if you really need these multiple rows? I think the test is still valid with fewer rows (maybe just 1 row). WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eh, I'm fine with leaving it. Consistent with other tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I agree. If possible, I want to have minimum amount of test data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@tmatsuo let me know if you think this is ready, thanks |
@tmatsuo the Lint is failing, but when I try to run the linter locally it says the noxfile isn't found
|
@billyjacobson Now you have to temporarily copy the The code looks good now and I hope rebasing will solve the linter. |
@billyjacobson Merged. Thanks for your patience. |
No description provided.