Skip to content

Commit

Permalink
Merge pull request #44 from conductor-sdk/refactor-tests
Browse files Browse the repository at this point in the history
Refactored tests to use standard dockerfile between sdks
  • Loading branch information
gardusig authored Jan 25, 2023
2 parents 70d5214 + 492f661 commit 0d1963b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: >
DOCKER_BUILDKIT=1 docker build
--target=test
--build-arg SDK_INTEGRATION_TESTS_SERVER_API_URL=${{ secrets.SDK_INTEGRATION_TESTS_SERVER_API_URL }}
--build-arg SDK_INTEGRATION_TESTS_SERVER_KEY_ID=${{ secrets.SDK_INTEGRATION_TESTS_SERVER_KEY_ID }}
--build-arg SDK_INTEGRATION_TESTS_SERVER_KEY_SECRET=${{ secrets.SDK_INTEGRATION_TESTS_SERVER_KEY_SECRET }}
--build-arg KEY=${{ secrets.KEY }}
--build-arg SECRET=${{ secrets.SECRET }}
--build-arg CONDUCTOR_SERVER_URL=${{ secrets.CONDUCTOR_SERVER_URL }}
.
3 changes: 2 additions & 1 deletion Conductor/Client/Worker/WorkflowTaskExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ private async Task Poll()
}
logger.LogDebug($"{GetWorkerName()} - Poll ended");

if (!hasPolledAnyTask) {
if (!hasPolledAnyTask)
{
await Sleep();
}
}
Expand Down
22 changes: 10 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS raw_base_image
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS csharp-sdk
RUN mkdir /package
COPY /Conductor /package/Conductor
WORKDIR /package/Conductor

FROM raw_base_image AS linter
FROM csharp-sdk AS linter
RUN dotnet format --verify-no-changes *.csproj

FROM raw_base_image AS build
FROM csharp-sdk AS build
RUN dotnet build *.csproj

FROM build as build_with_integration_tests_env
ARG SDK_INTEGRATION_TESTS_SERVER_API_URL
ENV SDK_INTEGRATION_TESTS_SERVER_API_URL=${SDK_INTEGRATION_TESTS_SERVER_API_URL}
ARG SDK_INTEGRATION_TESTS_SERVER_KEY_ID
ENV SDK_INTEGRATION_TESTS_SERVER_KEY_ID=${SDK_INTEGRATION_TESTS_SERVER_KEY_ID}
ARG SDK_INTEGRATION_TESTS_SERVER_KEY_SECRET
ENV SDK_INTEGRATION_TESTS_SERVER_KEY_SECRET=${SDK_INTEGRATION_TESTS_SERVER_KEY_SECRET}

FROM build_with_integration_tests_env AS test
FROM build as test
ARG KEY
ARG SECRET
ARG CONDUCTOR_SERVER_URL
ENV KEY=${KEY}
ENV SECRET=${SECRET}
ENV CONDUCTOR_SERVER_URL=${CONDUCTOR_SERVER_URL}
COPY /Tests /package/Tests
WORKDIR /package/Tests
RUN dotnet test -l "console;verbosity=normal"
Expand Down
6 changes: 3 additions & 3 deletions Tests/Util/ApiUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace Tests.Util
{
public class ApiUtil
{
private const string ENV_ROOT_URI = "SDK_INTEGRATION_TESTS_SERVER_API_URL";
private const string ENV_KEY_ID = "SDK_INTEGRATION_TESTS_SERVER_KEY_ID";
private const string ENV_SECRET = "SDK_INTEGRATION_TESTS_SERVER_KEY_SECRET";
private const string ENV_ROOT_URI = "CONDUCTOR_SERVER_URL";
private const string ENV_KEY_ID = "KEY";
private const string ENV_SECRET = "SECRET";

private static string _basePath = null;
private static string _keyId = null;
Expand Down

0 comments on commit 0d1963b

Please sign in to comment.