Skip to content

Commit e4f4412

Browse files
source-faker to Beta + Fix AllowedHosts Checks (#22117)
* beta faker + no allowed hosts * V2.0.1 * fixup python checks * add back allowedHosts * simplify * simplify releaseStage * bump expected records * More mock logger methods * auto-bump connector version --------- Co-authored-by: Octavia Squidington III <[email protected]>
1 parent 1f2b6d6 commit e4f4412

File tree

10 files changed

+149
-142
lines changed

10 files changed

+149
-142
lines changed

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,11 +504,11 @@
504504
- name: Sample Data (Faker)
505505
sourceDefinitionId: dfd88b22-b603-4c3d-aad7-3701784586b1
506506
dockerRepository: airbyte/source-faker
507-
dockerImageTag: 2.0.0
507+
dockerImageTag: 2.0.1
508508
documentationUrl: https://docs.airbyte.com/integrations/sources/faker
509509
icon: faker.svg
510510
sourceType: api
511-
releaseStage: alpha
511+
releaseStage: beta
512512
allowedHosts:
513513
hosts: []
514514
suggestedStreams:

airbyte-config/init/src/main/resources/seed/source_specs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4034,7 +4034,7 @@
40344034
supportsNormalization: false
40354035
supportsDBT: false
40364036
supported_destination_sync_modes: []
4037-
- dockerImage: "airbyte/source-faker:2.0.0"
4037+
- dockerImage: "airbyte/source-faker:2.0.1"
40384038
spec:
40394039
documentationUrl: "https://docs.airbyte.com/integrations/sources/faker"
40404040
connectionSpecification:

airbyte-integrations/connectors/source-faker/CHANGELOG.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

airbyte-integrations/connectors/source-faker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ COPY source_faker ./source_faker
3434
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
3535
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
3636

37-
LABEL io.airbyte.version=2.0.0
37+
LABEL io.airbyte.version=2.0.1
3838
LABEL io.airbyte.name=airbyte/source-faker

airbyte-integrations/connectors/source-faker/integration_tests/expected_records.jsonl

Lines changed: 120 additions & 120 deletions
Large diffs are not rendered by default.

airbyte-integrations/connectors/source-faker/unit_tests/unit_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def exception(a,b,**kwargs):
1919
print(b)
2020
return None
2121

22+
def isEnabledFor(a, b, **kwargs):
23+
return False
24+
2225

2326
logger = MockLogger()
2427

docs/integrations/sources/faker.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ None!
8383

8484
| Version | Date | Pull Request | Subject |
8585
| :------ | :--------- | :-------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------- |
86+
| 2.0.1 | 2022-01-30 | [22117](https://github.com/airbytehq/airbyte/pull/22117) | `soruce-faker` goes beta |
8687
| 2.0.0 | 2022-12-14 | [20492](https://github.com/airbytehq/airbyte/pull/20492) and [20741](https://github.com/airbytehq/airbyte/pull/20741) | Decouple stream states for better parallelism |
8788
| 1.0.0 | 2022-11-28 | [19490](https://github.com/airbytehq/airbyte/pull/19490) | Faker uses the CDK; rename streams to be lower-case (breaking), add determinism to random purchases, and rename |
8889
| 0.2.1 | 2022-10-14 | [19197](https://github.com/airbytehq/airbyte/pull/19197) | Emit `AirbyteEstimateTraceMessage` |

tools/ci_connector_ops/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ source .venv/bin/activate
1818
pip install -e . # assuming you are in the ./tools/ci_connector_ops directory
1919
```
2020

21-
pip will make binaries for all the commands in setup.py, so you can run `allowed-hosts-check` directly from the virtual-env
21+
pip will make binaries for all the commands in setup.py, so you can run `allowed-hosts-checks` directly from the virtual-env

tools/ci_connector_ops/ci_connector_ops/allowed_hosts_checks.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,20 @@
1010

1111
RELEASE_STAGES_TO_CHECK = ["generally_available", "beta"]
1212

13-
def get_connectors_missing_allowed_hosts() -> List[str]:
14-
connectors_missing_allowed_hosts = []
15-
changed_connector_names = utils.get_changed_connector_names()
16-
17-
for connector_name in changed_connector_names:
18-
connector_release_stage = utils.get_connector_release_stage(connector_name)
19-
if connector_release_stage in RELEASE_STAGES_TO_CHECK:
20-
missing = not connector_has_allowed_hosts(connector_name)
13+
def get_connectors_missing_allowed_hosts() -> List[utils.Connector]:
14+
connectors_missing_allowed_hosts: List[utils.Connector] = []
15+
changed_connectors = utils.get_changed_connectors()
16+
17+
for connector in changed_connectors:
18+
if connector.release_stage in RELEASE_STAGES_TO_CHECK:
19+
missing = not connector_has_allowed_hosts(connector)
2120
if missing:
22-
connectors_missing_allowed_hosts.append(connector_name)
21+
connectors_missing_allowed_hosts.append(connector)
2322

2423
return connectors_missing_allowed_hosts
2524

26-
def connector_has_allowed_hosts(connector_name: str) -> bool:
27-
definition = utils.get_connector_definition(connector_name)
28-
return definition.get("allowedHosts") is not None
25+
def connector_has_allowed_hosts(connector: utils.Connector) -> bool:
26+
return connector.allowed_hosts is not None
2927

3028

3129
def check_allowed_hosts():

tools/ci_connector_ops/ci_connector_ops/utils.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from dataclasses import dataclass
77
import logging
88
from pathlib import Path
9-
from typing import Dict, Optional, Set, Tuple
9+
from typing import Dict, Optional, Set, Tuple, List
1010
import os
1111
import git
1212
import requests
@@ -135,7 +135,15 @@ def definition(self) -> Optional[dict]:
135135

136136
@property
137137
def release_stage(self) -> Optional[str]:
138-
return self.definition["releaseStage"] if self.definition else None
138+
return self.definition.get("releaseStage") if self.definition else None
139+
140+
@property
141+
def allowed_hosts(self) -> Optional[List[str]]:
142+
return self.definition.get("allowedHosts") if self.definition else None
143+
144+
@property
145+
def suggested_streams(self) -> Optional[List[str]]:
146+
return self.definition.get("suggestedStreams") if self.definition else None
139147

140148
@property
141149
def acceptance_test_config_path(self) -> Path:

0 commit comments

Comments
 (0)