Skip to content

Commit

Permalink
connectors-ci: load secrets on unit tests (airbytehq#25557)
Browse files Browse the repository at this point in the history
  • Loading branch information
alafanechere authored and marcosmarxm committed Jun 8, 2023
1 parent 7f47b62 commit 3973679
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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
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

0 comments on commit 3973679

Please sign in to comment.