Skip to content

Commit 79acc2b

Browse files
🎉 Source Recurly: migrate to the CDK
* Source Microsoft Teams #8315 - migrate to the CDK * Source Microsoft Teams #8315 - acceptances test * Source Microsoft Teams #8315 - fixed schemas * Source Microsoft Teams #8315 - reformat * Source Microsoft Teams #8315 - bump version * Source Recurly #8318 - reformat
1 parent d8bc8c1 commit 79acc2b

28 files changed

+240
-195
lines changed

airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/cd42861b-01fc-4658-a8ab-5d11d0510f01.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"sourceDefinitionId": "cd42861b-01fc-4658-a8ab-5d11d0510f01",
33
"name": "Recurly",
44
"dockerRepository": "airbyte/source-recurly",
5-
"dockerImageTag": "0.2.4",
5+
"dockerImageTag": "0.2.6",
66
"documentationUrl": "https://docs.airbyte.io/integrations/sources/recurly",
77
"icon": "recurly.svg"
88
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@
533533
- name: Recurly
534534
sourceDefinitionId: cd42861b-01fc-4658-a8ab-5d11d0510f01
535535
dockerRepository: airbyte/source-recurly
536-
dockerImageTag: 0.2.4
536+
dockerImageTag: 0.2.6
537537
documentationUrl: https://docs.airbyte.io/integrations/sources/recurly
538538
icon: recurly.svg
539539
sourceType: api

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -5101,7 +5101,7 @@
51015101
supportsNormalization: false
51025102
supportsDBT: false
51035103
supported_destination_sync_modes: []
5104-
- dockerImage: "airbyte/source-recurly:0.2.4"
5104+
- dockerImage: "airbyte/source-recurly:0.2.6"
51055105
spec:
51065106
documentationUrl: "https://docs.airbyte.io/integrations/sources/recurly"
51075107
connectionSpecification:

airbyte-integrations/connectors/source-microsoft-teams/integration_tests/acceptance.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@
1212
def connector_setup():
1313
"""This fixture is a placeholder for external resources that acceptance test might require."""
1414
yield
15-

airbyte-integrations/connectors/source-microsoft-teams/integration_tests/sample_config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
"client_id": "<your client ID>",
44
"client_secret": "<your client secret>",
55
"period": "D7"
6-
}
6+
}

airbyte-integrations/connectors/source-microsoft-teams/source_microsoft_teams/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
import backoff
1515
import msal
1616
import requests
17-
from airbyte_cdk.models.airbyte_protocol import AirbyteStream
1817
from airbyte_cdk.logger import AirbyteLogger
18+
from airbyte_cdk.models.airbyte_protocol import AirbyteStream
1919
from msal.exceptions import MsalServiceError
2020

2121
LOGGER = AirbyteLogger()
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
build
1+
*
2+
!Dockerfile
3+
!main.py
4+
!source_recurly
5+
!setup.py
6+
!secrets
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
1-
FROM airbyte/integration-base-python:0.1.1
1+
FROM python:3.7.11-alpine3.14 as base
22

3-
# Bash is installed for more convenient debugging.
4-
RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/*
3+
# build and load all requirements
4+
FROM base as builder
5+
WORKDIR /airbyte/integration_code
6+
7+
# upgrade pip to the latest version
8+
RUN apk --no-cache upgrade \
9+
&& pip install --upgrade pip \
10+
&& apk --no-cache add tzdata build-base
511

6-
ENV CODE_PATH="source_recurly"
7-
ENV AIRBYTE_IMPL_MODULE="source_recurly"
8-
ENV AIRBYTE_IMPL_PATH="SourceRecurly"
912

10-
WORKDIR /airbyte/integration_code
11-
COPY $CODE_PATH ./$CODE_PATH
1213
COPY setup.py ./
13-
RUN pip install .
14+
# install necessary packages to a temporary folder
15+
RUN pip install --prefix=/install .
16+
17+
# build a clean environment
18+
FROM base
19+
WORKDIR /airbyte/integration_code
20+
21+
# copy all loaded and built libraries to a pure basic image
22+
COPY --from=builder /install /usr/local
23+
# add default timezone settings
24+
COPY --from=builder /usr/share/zoneinfo/Etc/UTC /etc/localtime
25+
RUN echo "Etc/UTC" > /etc/timezone
26+
27+
# bash is installed for more convenient debugging.
28+
RUN apk --no-cache add bash
29+
30+
# copy payload code only
31+
COPY main.py ./
32+
COPY source_recurly ./source_recurly
1433

15-
ENV AIRBYTE_ENTRYPOINT "/airbyte/base.sh"
34+
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
35+
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
1636

17-
LABEL io.airbyte.version=0.2.5
37+
LABEL io.airbyte.version=0.2.6
1838
LABEL io.airbyte.name=airbyte/source-recurly
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# See [Source Acceptance Tests](https://docs.airbyte.io/connector-development/testing-connectors/source-acceptance-tests-reference)
2+
# for more information about how to configure these tests
3+
connector_image: airbyte/source-recurly:dev
4+
tests:
5+
spec:
6+
- spec_path: "source_recurly/spec.json"
7+
connection:
8+
- config_path: "secrets/config.json"
9+
status: "succeed"
10+
- config_path: "integration_tests/invalid_config.json"
11+
status: "failed"
12+
discovery:
13+
- config_path: "secrets/config.json"
14+
basic_read:
15+
- config_path: "secrets/config.json"
16+
configured_catalog_path: "integration_tests/configured_catalog.json"
17+
empty_streams: []
18+
full_refresh:
19+
- config_path: "secrets/config.json"
20+
configured_catalog_path: "integration_tests/configured_catalog.json"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env sh
2+
3+
# Build latest connector image
4+
docker build . -t $(cat acceptance-test-config.yml | grep "connector_image" | head -n 1 | cut -d: -f2)
5+
6+
# Pull latest acctest image
7+
docker pull airbyte/source-acceptance-test:latest
8+
9+
# Run
10+
docker run --rm -it \
11+
-v /var/run/docker.sock:/var/run/docker.sock \
12+
-v /tmp:/tmp \
13+
-v $(pwd):/test_input \
14+
airbyte/source-acceptance-test \
15+
--acceptance-test-config /test_input
16+
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
plugins {
22
id 'airbyte-docker'
33
id 'airbyte-python'
4-
id 'airbyte-standard-source-test-file'
4+
id 'airbyte-source-acceptance-test'
55
}
66

77
airbytePython {
88
moduleDirectory 'source_recurly'
99
}
1010

11-
12-
airbyteStandardSourceTestFile {
13-
specPath = "source_recurly/spec.json"
14-
configPath = "secrets/config.json"
15-
configuredCatalogPath = "integration_tests/configured_catalog.json"
16-
}
17-
18-
19-
20-
dependencies {
21-
implementation files(project(':airbyte-integrations:bases:base-standard-source-test-file').airbyteDocker.outputs)
22-
implementation files(project(':airbyte-integrations:bases:base-python').airbyteDocker.outputs)
23-
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
3+
#
4+
5+
6+
import pytest
7+
8+
pytest_plugins = ("source_acceptance_test.plugin",)
9+
10+
11+
@pytest.fixture(scope="session", autouse=True)
12+
def connector_setup():
13+
"""This fixture is a placeholder for external resources that acceptance test might require."""
14+
yield

airbyte-integrations/connectors/source-recurly/integration_tests/configured_catalog.json

+56-95
Original file line numberDiff line numberDiff line change
@@ -3,101 +3,62 @@
33
{
44
"stream": {
55
"name": "accounts",
6-
"supported_sync_modes": ["full_refresh"],
7-
"source_defined_cursor": false,
8-
"json_schema": {
9-
"$schema": "http://json-schema.org/draft-07/schema#",
10-
"type": "object",
11-
"properties": {
12-
"id": {
13-
"type": "string"
14-
},
15-
"object": {
16-
"type": "string"
17-
},
18-
"code": {
19-
"type": "string"
20-
},
21-
"parent_account_id": {
22-
"type": "string"
23-
},
24-
"bill_to": {
25-
"type": "string"
26-
},
27-
"state": {
28-
"type": "string"
29-
},
30-
"username": {
31-
"type": "string"
32-
},
33-
"email": {
34-
"type": "string"
35-
},
36-
"cc_emails": {
37-
"type": "string"
38-
},
39-
"preferred_locale": {
40-
"type": "string"
41-
},
42-
"first_name": {
43-
"type": "string"
44-
},
45-
"last_name": {
46-
"type": "string"
47-
},
48-
"company": {
49-
"type": "string"
50-
},
51-
"vat_number": {
52-
"type": "string"
53-
},
54-
"tax_exempt": {
55-
"type": "boolean"
56-
},
57-
"exemption_certificate": {
58-
"type": "string"
59-
},
60-
"address": {
61-
"type": "object"
62-
},
63-
"billing_info": {
64-
"type": "object"
65-
},
66-
"shipping_addresses": {
67-
"type": "array"
68-
},
69-
"custom_fields": {
70-
"type": "array"
71-
},
72-
"has_live_subscription": {
73-
"type": "boolean"
74-
},
75-
"has_active_subscription": {
76-
"type": "boolean"
77-
},
78-
"has_future_subscription": {
79-
"type": "boolean"
80-
},
81-
"has_canceled_subscription": {
82-
"type": "boolean"
83-
},
84-
"has_paused_subscription": {
85-
"type": "boolean"
86-
},
87-
"has_past_due_invoice": {
88-
"type": "boolean"
89-
},
90-
"created_at": {
91-
"type": "string"
92-
},
93-
"updated_at": {
94-
"type": "string"
95-
},
96-
"deleted_at": {
97-
"type": "string"
98-
}
99-
}
100-
}
6+
"json_schema": {},
7+
"supported_sync_modes": ["full_refresh"]
8+
},
9+
"sync_mode": "full_refresh",
10+
"destination_sync_mode": "overwrite"
11+
},
12+
{
13+
"stream": {
14+
"name": "coupons",
15+
"json_schema": {},
16+
"supported_sync_modes": ["full_refresh"]
17+
},
18+
"sync_mode": "full_refresh",
19+
"destination_sync_mode": "overwrite"
20+
},
21+
{
22+
"stream": {
23+
"name": "invoices",
24+
"json_schema": {},
25+
"supported_sync_modes": ["full_refresh"]
26+
},
27+
"sync_mode": "full_refresh",
28+
"destination_sync_mode": "overwrite"
29+
},
30+
{
31+
"stream": {
32+
"name": "plans",
33+
"json_schema": {},
34+
"supported_sync_modes": ["full_refresh"]
35+
},
36+
"sync_mode": "full_refresh",
37+
"destination_sync_mode": "overwrite"
38+
},
39+
{
40+
"stream": {
41+
"name": "measured_units",
42+
"json_schema": {},
43+
"supported_sync_modes": ["full_refresh"]
44+
},
45+
"sync_mode": "full_refresh",
46+
"destination_sync_mode": "overwrite"
47+
},
48+
{
49+
"stream": {
50+
"name": "subscriptions",
51+
"json_schema": {},
52+
"supported_sync_modes": ["full_refresh"]
53+
},
54+
"sync_mode": "full_refresh",
55+
"destination_sync_mode": "overwrite"
56+
},
57+
{
58+
"stream": {
59+
"name": "transactions",
60+
"json_schema": {},
61+
"supported_sync_modes": ["full_refresh"]
10162
},
10263
"sync_mode": "full_refresh",
10364
"destination_sync_mode": "overwrite"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"api_key": "wrong-api-key"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"api_key": "api-key"
3+
}

airbyte-integrations/connectors/source-recurly/main_dev.py airbyte-integrations/connectors/source-recurly/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import sys
77

8-
from base_python.entrypoint import launch
8+
from airbyte_cdk.entrypoint import launch
99
from source_recurly import SourceRecurly
1010

1111
if __name__ == "__main__":
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# This file is autogenerated -- only edit if you know what you are doing. Use setup.py for declaring dependencies.
2-
-e ../../bases/airbyte-protocol
3-
-e ../../bases/base-python
2+
-e ../../bases/source-acceptance-test
43
-e .

airbyte-integrations/connectors/source-recurly/setup.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@
55

66
from setuptools import find_packages, setup
77

8+
MAIN_REQUIREMENTS = ["airbyte-cdk~=0.1", "recurly==3.14.0", "requests"]
9+
10+
TEST_REQUIREMENTS = [
11+
"pytest~=6.1",
12+
"pytest-mock~=3.6.1",
13+
"source-acceptance-test",
14+
]
15+
816
setup(
917
name="source_recurly",
1018
description="Source implementation for Recurly.",
1119
author="Airbyte",
1220
author_email="contact@airbyte.io",
1321
packages=find_packages(),
14-
install_requires=["airbyte-protocol", "base-python", "recurly==3.14.0", "requests", "pytest==6.1.2"],
15-
package_data={"": ["*.json", "schemas/*.json"]},
22+
install_requires=MAIN_REQUIREMENTS,
23+
package_data={"": ["*.json", "schemas/*.json", "schemas/shared/*.json"]},
24+
extras_require={
25+
"tests": TEST_REQUIREMENTS,
26+
},
1627
)

0 commit comments

Comments
 (0)