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

connectors-ci: load secrets on unit tests #25557

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 4bfac00d-ce15-44ff-95b9-9e3c3e8fbd35
dockerImageTag: 2.0.6
dockerImageTag: 3.0.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.

I'm bumping the version here to trigger the tests on this source and eventually publish on merge.

dockerRepository: airbyte/source-tiktok-marketing
githubIssueLabel: source-tiktok-marketing
icon: tiktok.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ async def _run(self, connector_under_test: Container) -> StepResult:
Returns:
StepResult: Failure or success of the unit tests with stdout and stdout.
"""
return await self._run_tests_in_directory(connector_under_test, "unit_tests")
connector_under_test_with_secrets = connector_under_test.with_directory(
f"{self.context.connector.code_directory}/secrets", self.context.secrets_dir
)
return await self._run_tests_in_directory(connector_under_test_with_secrets, "unit_tests")


class IntegrationTests(PytestStep):
Expand Down Expand Up @@ -127,12 +130,12 @@ async def run_all_tests(context: ConnectorContext) -> List[StepResult]:
connector_image_tar_file, _ = await export_container_to_tarball(context, build_connector_image_results.output_artifact)
connector_container = connector_package_install_results.output_artifact

context.secrets_dir = await secrets.get_connector_secret_dir(context)

unit_test_results = await UnitTests(context).run(connector_container)
if unit_test_results.status is StepStatus.FAILURE:
return step_results + [unit_test_results]

context.secrets_dir = await secrets.get_connector_secret_dir(context)

async with asyncer.create_task_group() as task_group:
tasks = [
task_group.soonify(IntegrationTests(context).run)(connector_container),
Expand Down