Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 13 commits into from
May 13, 2020
Merged

[bigtable] Cloud function example #3486

merged 13 commits into from
May 13, 2020

Conversation

billyjacobson
Copy link
Member

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 23, 2020
@billyjacobson billyjacobson marked this pull request as ready for review April 24, 2020 19:02
@billyjacobson billyjacobson requested review from grant and a team as code owners April 24, 2020 19:02
bigtable.Client = MagicMock()


class TestingRow:
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

bigtable.Client = MagicMock()


class TestingRow:
Copy link
Contributor

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?

@billyjacobson
Copy link
Member Author

@tmatsuo tests are fixed and green :)

@tmatsuo
Copy link
Contributor

tmatsuo commented Apr 30, 2020

@billyjacobson I still see the test with a mock.

@billyjacobson
Copy link
Member Author

@tmatsuo oops!! I forgot to push, sorry about that

import datetime
import os
import uuid
import pytest
Copy link
Contributor

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

?

Copy link
Contributor

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.

Copy link
Member Author

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
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

@billyjacobson
Copy link
Member Author

@tmatsuo let me know if you think this is ready, thanks

@billyjacobson
Copy link
Member Author

@tmatsuo the Lint is failing, but when I try to run the linter locally it says the noxfile isn't found

python-docs-samples[bigtable-function]$ nox -s "lint(sample='./functions/bigtable')"
nox > Noxfile /Users/thebilly/dev/python-docs-samples/noxfile.py not found.

@tmatsuo
Copy link
Contributor

tmatsuo commented May 13, 2020

@billyjacobson Now you have to temporarily copy the noxfile-template.py at the project root to noxfile.py in your project directory to run the test (I know it's cumbersome, it's an interim state until we copy our noxfile over).

The code looks good now and I hope rebasing will solve the linter.

@tmatsuo tmatsuo merged commit e0a4bd6 into master May 13, 2020
@tmatsuo tmatsuo deleted the bigtable-function branch May 13, 2020 04:54
@tmatsuo
Copy link
Contributor

tmatsuo commented May 13, 2020

@billyjacobson Merged. Thanks for your patience.

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.

6 participants