-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉 Source File: Migrate File source to CDK structure (#7387)
* Migrate File source to CDK structure * fix .dockerignore file * remove SAT requirements * update Dockerfile * change Dockerfile to base images python:3.7-slim * add SAT tests * update tests * add secret/config.json for source-file * update changelogs
- Loading branch information
1 parent
cdb80f4
commit 269298c
Showing
19 changed files
with
134 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
build | ||
|
||
* | ||
!Dockerfile | ||
!main.py | ||
!source_file | ||
!setup.py | ||
!integration_tests | ||
!secrets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
FROM airbyte/integration-base-python:0.1.1 | ||
FROM python:3.7-slim | ||
|
||
# Bash is installed for more convenient debugging. | ||
RUN apt-get update && apt-get install -y jq curl bash && rm -rf /var/lib/apt/lists/* | ||
|
||
ENV CODE_PATH="source_file" | ||
ENV AIRBYTE_IMPL_MODULE="source_file" | ||
ENV AIRBYTE_IMPL_PATH="SourceFile" | ||
|
||
WORKDIR /airbyte/integration_code | ||
COPY $CODE_PATH ./$CODE_PATH | ||
COPY source_file ./source_file | ||
COPY main.py ./ | ||
COPY setup.py ./ | ||
RUN pip install . | ||
|
||
ENV AIRBYTE_ENTRYPOINT "/airbyte/base.sh" | ||
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" | ||
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] | ||
|
||
LABEL io.airbyte.version=0.2.6 | ||
LABEL io.airbyte.version=0.2.7 | ||
LABEL io.airbyte.name=airbyte/source-file |
19 changes: 19 additions & 0 deletions
19
airbyte-integrations/connectors/source-file/acceptance-test-config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# See [Source Acceptance Tests](https://docs.airbyte.io/connector-development/testing-connectors/source-acceptance-tests-reference) | ||
# for more information about how to configure these tests | ||
connector_image: airbyte/source-file:dev | ||
tests: | ||
spec: | ||
- spec_path: "source_file/spec.json" | ||
connection: | ||
- config_path: "integration_tests/config.json" | ||
status: "succeed" | ||
- config_path: "integration_tests/invalid_config.json" | ||
status: "failed" | ||
discovery: | ||
- config_path: "integration_tests/config.json" | ||
basic_read: | ||
- config_path: "integration_tests/config.json" | ||
configured_catalog_path: "integration_tests/configured_catalog.json" | ||
full_refresh: | ||
- config_path: "integration_tests/config.json" | ||
configured_catalog_path: "integration_tests/configured_catalog.json" |
15 changes: 15 additions & 0 deletions
15
airbyte-integrations/connectors/source-file/acceptance-test-docker.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env sh | ||
|
||
# Build latest connector image | ||
docker build . -t $(cat acceptance-test-config.yml | grep "connector_image" | head -n 1 | cut -d: -f2) | ||
|
||
# Pull latest acctest image | ||
docker pull airbyte/source-acceptance-test:latest | ||
|
||
# Run | ||
docker run --rm -it \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v /tmp:/tmp \ | ||
-v $(pwd):/test_input \ | ||
airbyte/source-acceptance-test \ | ||
--acceptance-test-config /test_input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,9 @@ | ||
import ru.vyarus.gradle.plugin.python.task.PythonTask | ||
|
||
plugins { | ||
id 'airbyte-python' | ||
id 'airbyte-docker' | ||
id 'airbyte-standard-source-test-file' | ||
id 'airbyte-source-acceptance-test' | ||
} | ||
|
||
airbytePython { | ||
moduleDirectory 'source_file' | ||
} | ||
|
||
|
||
airbyteStandardSourceTestFile { | ||
specPath = "source_file/spec.json" | ||
configPath = "integration_tests/config.json" | ||
configuredCatalogPath = "integration_tests/configured_catalog.json" | ||
} | ||
|
||
task("customIntegrationTestPython", type: PythonTask, dependsOn: installTestReqs){ | ||
module = "pytest" | ||
command = "-s integration_tests" | ||
} | ||
|
||
integrationTest.dependsOn("customIntegrationTestPython") | ||
|
||
|
||
dependencies { | ||
implementation files(project(':airbyte-integrations:bases:base-standard-source-test-file').airbyteDocker.outputs) | ||
implementation files(project(':airbyte-integrations:bases:base-python').airbyteDocker.outputs) | ||
} |
3 changes: 3 additions & 0 deletions
3
airbyte-integrations/connectors/source-file/integration_tests/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# | ||
# Copyright (c) 2021 Airbyte, Inc., all rights reserved. | ||
# |
16 changes: 16 additions & 0 deletions
16
airbyte-integrations/connectors/source-file/integration_tests/acceptance.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# | ||
# Copyright (c) 2021 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
|
||
import pytest | ||
|
||
pytest_plugins = ("source_acceptance_test.plugin",) | ||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def connector_setup(): | ||
"""This fixture is a placeholder for external resources that acceptance test might require.""" | ||
# TODO: setup test dependencies | ||
yield | ||
# TODO: clean up test dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
airbyte-integrations/connectors/source-file/integration_tests/invalid_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"dataset_name": "fake_csv", | ||
"format": "csv", | ||
"reader_options": "{\"sep\": \",\", \"nrows\": 20}", | ||
"url": "https://test.fakr.com/cfake_data.csv", | ||
"provider": { | ||
"storage": "HTTPS", | ||
"reader_impl": "fake" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# This file is autogenerated -- only edit if you know what you are doing. Use setup.py for declaring dependencies. | ||
-e ../../bases/airbyte-protocol | ||
-e ../../bases/base-python | ||
-e ../../bases/source-acceptance-test | ||
-e . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.