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

🐛 source-file: fix integration tests #31152

Closed
wants to merge 5 commits into from

Conversation

pedroslopez
Copy link
Contributor

@pedroslopez pedroslopez commented Oct 6, 2023

What

split from #30984

Integration tests have been broken for source-file for a long time. Installing test dependencies ran indefinitely due to a resolution issue. This PR fixes it.

How

  • airbyte-ci: Include docker as dependency in test containers
  • source-file: remove docker-compose python dependency, which is deprecated. bump pytest-docker to v2 to use new docker compose v2.

@vercel
Copy link

vercel bot commented Oct 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Oct 6, 2023 10:58pm

Copy link
Contributor Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2023

Before Merging a Connector Pull Request

Wow! What a great pull request you have here! 🎉

To merge this PR, ensure the following has been done/considered for each connector added or updated:

  • PR name follows PR naming conventions
  • Breaking changes are considered. If a Breaking Change is being introduced, ensure an Airbyte engineer has created a Breaking Change Plan.
  • Connector version has been incremented in the Dockerfile and metadata.yaml according to our Semantic Versioning for Connectors guidelines
  • You've updated the connector's metadata.yaml file any other relevant changes, including a breakingChanges entry for major version bumps. See metadata.yaml docs
  • Secrets in the connector's spec are annotated with airbyte_secret
  • All documentation files are up to date. (README.md, bootstrap.md, docs.md, etc...)
  • Changelog updated in docs/integrations/<source or destination>/<name>.md with an entry for the new version. See changelog example
  • Migration guide updated in docs/integrations/<source or destination>/<name>-migrations.md with an entry for the new version, if the version is a breaking change. See migration guide example
  • If set, you've ensured the icon is present in the platform-internal repo. (Docs)

If the checklist is complete, but the CI check is failing,

  1. Check for hidden checklists in your PR description

  2. Toggle the github label checklist-action-run on/off to re-run the checklist CI.

@pedroslopez pedroslopez changed the title source-file: fix integration tests 🐛 source-file: fix integration tests Oct 6, 2023
@pedroslopez pedroslopez marked this pull request as ready for review October 6, 2023 23:01
@pedroslopez pedroslopez requested review from bnchrch, erohmensing and a team October 6, 2023 23:01
@@ -57,7 +57,7 @@ def with_python_base(context: PipelineContext, python_version: str = "3.10") ->
sh_dash_c(
[
"apt-get update",
"apt-get install -y build-essential cmake g++ libffi-dev libstdc++6 git",
"apt-get install -y build-essential cmake g++ libffi-dev libstdc++6 git curl",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required to be able to install docker

@@ -82,6 +82,7 @@ def with_testing_dependencies(context: PipelineContext) -> Container:

return (
python_environment.with_exec(["pip", "install"] + CONNECTOR_TESTING_REQUIREMENTS)
.with_exec(sh_dash_c(["curl -fsSL https://get.docker.com | sh"]))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python test containers now include docker

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the use case in here is we want to be able to use docker in tests to spin up containers nessessary for certain test environments. e.g. source-file needs docker compose for its test "remote" file server

(@pedroslopez do I have that right?)

In any sense looking at the code we already have I see with_global_dockerd_service and with_docker_cli inside the environments.py mega file.

But I dont think those are useful here for installing docker-compose.

(@alafanechere can you fact check me here?)

So if thats all true then I think were on the right track but should have a modification

  1. Lets not use curl
  2. Lets install docker / docker-compose via apt-get

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: In #30474 this with_testing_dependencies function is removed. Connectors test will run inside the connector container on top of which we'd install its testing dependencies according to its setup.py.
I believe docker as a system dependency should not be added to this function, nor to a future "pre/post" hook for source-file.

If we need docker-compose for testing I suggest to install the pip distributed docker-compose by declaring pytest-docker[docker-compose-v1] as a test requirement. see https://github.com/avast/pytest-docker .

If we really want to use the latest docker-compose version I suggest to only install the docker-compose plugin. This can be added to with_testing_dependencies in this PR but eventually added to a pre/post build hook following #30474 .

I'd prefer that we stick to the pip distributed docker compose as it will not require a pre/post build hook implementation for this connector. And I believe it's fine to use an old docker compose version in this context.

TEST_REQUIREMENTS = ["requests-mock~=1.9.3", "pytest~=6.2", "pytest-docker~=1.0.0", "pytest-mock~=3.6.1", "docker-compose"]
TEST_REQUIREMENTS = ["requests-mock~=1.9.3", "pytest~=6.2", "pytest-docker~=2.0", "pytest-mock~=3.6.1"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker-compose is deprecated and was causing infinite loop when installing test dependencies. We now bump pytest-docker to v2, which removes usages of docker-compose in favor of the new docker compose.

@airbyte-oss-build-runner
Copy link
Collaborator

source-file test report (commit 63b8aaf3e5) - ❌

⏲️ Total pipeline duration: 03mn36s

Step Result
Connector package install
Build source-file docker image for platform(s) linux/x86_64
Unit tests
Integration tests
Acceptance tests
Code format checks
Validate metadata for source-file
Connector version semver check
Connector version increment check
QA checks

🔗 View the logs here

☁️ View runs for commit in Dagger Cloud

Please note that tests are only run on PR ready for review. Please set your PR to draft mode to not flood the CI engine and upstream service on following commits.
You can run the same pipeline locally on this branch with the airbyte-ci tool with the following command

airbyte-ci connectors --name=source-file test

Copy link
Contributor

@erohmensing erohmensing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easier to review, thanks! Looks like we're missing a connector version bump for the change in test dependencies. With the blessing of ci, ship it!

@@ -82,6 +82,7 @@ def with_testing_dependencies(context: PipelineContext) -> Container:

return (
python_environment.with_exec(["pip", "install"] + CONNECTOR_TESTING_REQUIREMENTS)
.with_exec(sh_dash_c(["curl -fsSL https://get.docker.com | sh"]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: In #30474 this with_testing_dependencies function is removed. Connectors test will run inside the connector container on top of which we'd install its testing dependencies according to its setup.py.
I believe docker as a system dependency should not be added to this function, nor to a future "pre/post" hook for source-file.

If we need docker-compose for testing I suggest to install the pip distributed docker-compose by declaring pytest-docker[docker-compose-v1] as a test requirement. see https://github.com/avast/pytest-docker .

If we really want to use the latest docker-compose version I suggest to only install the docker-compose plugin. This can be added to with_testing_dependencies in this PR but eventually added to a pre/post build hook following #30474 .

I'd prefer that we stick to the pip distributed docker compose as it will not require a pre/post build hook implementation for this connector. And I believe it's fine to use an old docker compose version in this context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants