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

test: enable tests to run on kokoro #134

Merged
merged 7 commits into from Nov 9, 2021
Merged

test: enable tests to run on kokoro #134

merged 7 commits into from Nov 9, 2021

Conversation

skuruppu
Copy link
Contributor

No description provided.

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API. label Oct 13, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 13, 2021
@skuruppu skuruppu added kokoro:force-run Add this label to force Kokoro to re-run the tests. and removed kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Oct 14, 2021
@skuruppu
Copy link
Contributor Author

skuruppu commented Oct 15, 2021

@larkee or @IlyaFaer I'm trying to get the tests running on Kokoro. But as you can see above, the run fails with errors like:

____________________ ERROR at setup of test_get_table_names ____________________
Traceback (most recent call last):
  File "/tmpfs/src/github/python-spanner-sqlalchemy/.nox/snippets/lib/python3.8/site-packages/google/api_core/grpc_helpers.py", line 66, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/tmpfs/src/github/python-spanner-sqlalchemy/.nox/snippets/lib/python3.8/site-packages/grpc/_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/tmpfs/src/github/python-spanner-sqlalchemy/.nox/snippets/lib/python3.8/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
	status = StatusCode.NOT_FOUND
	details = "Instance not found: projects/precise-truck-742/instances/sqlalchemy-dialect-test"
	debug_error_string = "{"created":"@1634185605.444094995","description":"Error received from peer ipv4:74.125.142.95:443","file":"src/core/lib/surface/call.cc","file_line":1069,"grpc_message":"Instance not found: projects/precise-truck-742/instances/sqlalchemy-dialect-test","grpc_status":5}"

But you can see in the logs that nox > python create_test_database.py is executed without error. So I'm not quite sure why the tests are not able to find the instance.

@larkee I don't have permission on that project to see the instances.

Any help from either of you is appreciated. Then we can get rid of CircleCI which has been pretty flaky anyway.

@IlyaFaer
Copy link
Contributor

IlyaFaer commented Oct 15, 2021

@skuruppu, oh, I think I see where's the problem.

When we're running tests, we're actually creating a new instance and rewriting a config file, see:

instance_id = (
"sqlalchemy-dialect-test"
if USE_EMULATOR
else "sqlalchemy-test" + unique_resource_id
)

But this PR forces tests to be executed on sqlalchemy-dialect-test. So, the created instance has another name, not sqlalchemy-dialect-test, but "sqlalchemy-test" + unique_resource_id

@skuruppu
Copy link
Contributor Author

Ah thanks a lot @IlyaFaer. That explains it. So it was working fine for the migration tests which were reading test.cfg. But in a few other places, the code wasn't attempting to read the config file. The tests worked in the old project because we always had that static instance/database around but failed when we changed the project we were using. I've fixed them all now to read the url from the config file where possible.

@skuruppu
Copy link
Contributor Author

@IlyaFaer would you please be able to take a look at the 3 snippets test failures here?

@IlyaFaer
Copy link
Contributor

IlyaFaer commented Oct 19, 2021

@skuruppu, that's quite strange. Some methods are using rowcount under the hood (but I don't see the case for now - ouside the snippets those methods are working fine). Speaking of which, they're using it like this:

Безымянный

Taking a closer look

@IlyaFaer
Copy link
Contributor

IlyaFaer commented Oct 19, 2021

Okay, I've investigated it further. Looks like we need some small changes to throw a warning instead of an exception, 'cause we can't omit those methods and we can't support rowcount.

I've also tried to set dialect requirements to say rowcount is not supported, but technically it doesn't fix this particular error. So, I guess I'll push one PR into the original client:
googleapis/python-spanner#628

And some not very meaningful (but still should have) changes here.

@skuruppu skuruppu changed the title test: get project from env var test: use project from env var Oct 20, 2021
Copy link
Contributor

@IlyaFaer IlyaFaer left a comment

Choose a reason for hiding this comment

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

LGTM, we just need to wait for the other PR to be merged - it'll fix the failing tests

gcf-merge-on-green bot pushed a commit to googleapis/python-spanner that referenced this pull request Oct 26, 2021
@IlyaFaer IlyaFaer added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 26, 2021
@IlyaFaer
Copy link
Contributor

@skuruppu, looks like I can't restart Kokoro tests. Could you?

@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 26, 2021
@skuruppu
Copy link
Contributor Author

@IlyaFaer thanks a lot, the tests pass \o/

@IlyaFaer
Copy link
Contributor

@skuruppu, I guess now we need to make ci/circleci: build-and-test not required in the repository settings (I'd do this, but I don't have rights). Then we'll be able to merge the PR.

@skuruppu
Copy link
Contributor Author

Thanks @IlyaFaer. I should be able to fix the required check. I'm just waiting on @larkee to take a look as well since I wrote some very repetitive code here and if they have ideas on how to refactor out some of the code duplication then I wanted to fix that too before I merge it.

migration_test_cleanup.py Outdated Show resolved Hide resolved
test/test_suite.py Outdated Show resolved Hide resolved
"spanner:///projects/appdev-soda-spanner-staging/instances/"
"sqlalchemy-dialect-test/databases/compliance-test"
)
self._engine = create_engine(get_db_url())
Copy link
Contributor

Choose a reason for hiding this comment

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

An argument could be made to make a base test class that sets up the engine and metadata that these other test classes inherit but I don't think it's necessary for this PR

@skuruppu
Copy link
Contributor Author

skuruppu commented Nov 2, 2021

Thanks for the review @larkee. PTAL

I addressed your feedback except for the one about creating a base class for setting up the engine. @IlyaFaer if this is something that you can do, then I'm happy for you to do so in a separate PR.

@skuruppu skuruppu changed the title test: use project from env var test: enable tests to run on kokoro Nov 2, 2021
@IlyaFaer
Copy link
Contributor

IlyaFaer commented Nov 3, 2021

@skuruppu, okay, created an issue not to forget: #138
Will do.

@skuruppu skuruppu merged commit 05aa31e into googleapis:main Nov 9, 2021
asthamohta pushed a commit to asthamohta/python-spanner that referenced this pull request Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants