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

Revert "Fix connector base test" #9373

Merged
merged 1 commit into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion airbyte-cdk/python/airbyte_cdk/models/airbyte_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ class Config:
)
spec: Optional[ConnectorSpecification] = None
connectionStatus: Optional[AirbyteConnectionStatus] = None
catalog: Optional[AirbyteCatalog] = Field(None, description="catalog message: the calalog")
catalog: Optional[AirbyteCatalog] = Field(
None,
description="log message: any kind of logging you want the platform to know about.",
)
record: Optional[AirbyteRecordMessage] = Field(None, description="record message: the record")
state: Optional[AirbyteStateMessage] = Field(
None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class Config:
log: Optional[AirbyteLogMessage] = Field(None, description="log message: any kind of logging you want the platform to know about.")
spec: Optional[ConnectorSpecification] = None
connectionStatus: Optional[AirbyteConnectionStatus] = None
catalog: Optional[AirbyteCatalog] = Field(None, description="catalog message: the calalog")
catalog: Optional[AirbyteCatalog] = Field(None, description="log message: any kind of logging you want the platform to know about.")
record: Optional[AirbyteRecordMessage] = Field(None, description="record message: the record")
state: Optional[AirbyteStateMessage] = Field(
None, description="schema message: the state. Must be the last message produced. The platform uses this information"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,25 +256,27 @@ def test_failed_reading(traceback, container_error, last_line, expected_error):


@pytest.mark.parametrize(
"command,expected_count",
"command,wait_timeout,expected_count",
(
(
"cnt=0; while [ $cnt -lt 10 ]; do cnt=$((cnt+1)); echo something; done",
0,
10,
),
("echo something;", 1),
# Sometimes a container can finish own work before python tries to read it
("echo something;", 0.1, 1),
),
ids=["standard", "waiting"],
)
def test_docker_runner(command, expected_count):
def test_docker_runner(command, wait_timeout, expected_count):
client = docker.from_env()
new_container = client.containers.run(
image="busybox",
# Sometimes a container can finish its work before python tries to read it,
# so the container always sleeps for a while first.
command=f"""sh -c 'sleep 3; {command}'""",
command=f"""sh -c '{command}'""",
detach=True,
)
if wait_timeout:
time.sleep(wait_timeout)
lines = list(ConnectorRunner.read(new_container, command=command))
assert set(lines) == set(["something\n"])
assert len(lines) == expected_count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ private List<JsonNode> retrieveRecordsFromTable(final String tableName, final St
final ResultSet tableInfo = connection.createStatement()
.executeQuery(String.format("SHOW TABLES LIKE '%s' IN SCHEMA %s;", tableName, schema));
assertTrue(tableInfo.next());
// check that we're creating permanent tables. DBT defaults to transient tables, which have
// `TRANSIENT` as the value for the `kind` column.
// check that we're creating permanent tables. DBT defaults to transient tables, which have `TRANSIENT` as the value for the `kind` column.
assertEquals("TABLE", tableInfo.getString("kind"));
return connection.createStatement()
.executeQuery(String.format("SELECT * FROM %s.%s ORDER BY %s ASC;", schema, tableName, JavaBaseConstants.COLUMN_NAME_EMITTED_AT));
Expand Down