-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: add support for domain-scoped projects #185
Changes from 5 commits
a8a842d
7bd2d42
e133e68
bf0dffe
9201514
5f0c10d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,17 +14,52 @@ | |||||
|
||||||
import asyncio | ||||||
from datetime import datetime, timedelta | ||||||
from typing import Tuple | ||||||
|
||||||
import aiohttp | ||||||
from mocks import FakeAlloyDBClient | ||||||
import pytest | ||||||
|
||||||
from google.cloud.alloydb.connector.exceptions import RefreshError | ||||||
from google.cloud.alloydb.connector.instance import Instance | ||||||
from google.cloud.alloydb.connector.instance import _parse_instance_uri, Instance | ||||||
from google.cloud.alloydb.connector.refresh import _is_valid, RefreshResult | ||||||
from google.cloud.alloydb.connector.utils import generate_keys | ||||||
|
||||||
|
||||||
@pytest.mark.parametrize( | ||||||
"instance_uri, expected", | ||||||
[ | ||||||
( | ||||||
"projects/test-project/locations/test-region/clusters/test-cluster/instances/test-instance", | ||||||
("test-project", "test-region", "test-cluster", "test-instance"), | ||||||
), | ||||||
( | ||||||
"projects/test-domain:test-project/locations/test-region/clusters/test-cluster/instances/test-instance", | ||||||
( | ||||||
"test-domain:test-project", | ||||||
"test-region", | ||||||
"test-cluster", | ||||||
"test-instance", | ||||||
), | ||||||
), | ||||||
], | ||||||
) | ||||||
def test_parse_instance_uri(instance_uri: str, expected: Tuple[str, str, str]) -> None: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need the 4th
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my bad, I have added and pushed again with latest changes. |
||||||
""" | ||||||
Test that _parse_instance_uri correctly on | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, my bad! I have added it. |
||||||
normal instance uri and domain-scoped projects. | ||||||
""" | ||||||
assert expected == _parse_instance_uri(instance_uri) | ||||||
|
||||||
|
||||||
def test_parse_bad_instance_uri() -> None: | ||||||
""" | ||||||
Tests that ValueError is thrown for bad instance uri. | ||||||
""" | ||||||
with pytest.raises(ValueError): | ||||||
_parse_instance_uri("test-project:test-instance") | ||||||
|
||||||
|
||||||
@pytest.mark.asyncio | ||||||
async def test_Instance_init() -> None: | ||||||
""" | ||||||
|
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.
is the linter adding the
()
around this tuple? I don't think we need them as the function can just unpack the tuple into the appropriate variables.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.
yes @jackwotherspoon , the tuple was causing the formatting. I have removed it in the latest push.