Skip to content

Commit

Permalink
Update C# client tests for Generator version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
john-odonnell committed Oct 2, 2023
1 parent 31548cd commit ef53014
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 982 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
uses: actions/checkout@v2

- name: run integration test script
run: ./bin/test_integration -l csharp-netcore
run: ./bin/test_integration -l csharp
27 changes: 13 additions & 14 deletions bin/test_integration
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ USAGE
MANDATORY
-l|--language <language> Specify a client language to test.
Testable languages include
csharp-netcore and python.
Testable languages include:
${supported_langs[@]}
OPTIONS
-e|--enterprise Run tests against Conjur Enterprise.
Expand Down Expand Up @@ -52,7 +52,7 @@ else
sudo_prefix=""
fi

declare -a supported_langs=("csharp-netcore" "java" "python")
declare -a supported_langs=("csharp" "python")
language=""
test=""

Expand Down Expand Up @@ -100,13 +100,12 @@ done
if [[ -z "$language" ]]; then
echo "Missing required --language option"
echo "Valid language arguments:"
echo " csharp-netcore"
echo " python"
printf ' %s\n' "${supported_langs[@]}"
exit 1
fi

if [[ $enterprise -eq 1 ]]; then
if [[ "$language" == "csharp-netcore" ]]; then
if [[ "$language" == "csharp" ]]; then
echo "Enterprise tests for C# Conjur client not supported!"
exit 1
fi
Expand Down Expand Up @@ -145,26 +144,26 @@ configure_env() {
fi
}

run_csharp-netcore_tests(){
run_csharp_tests(){
if [[ -n "$test" ]]; then
test_params="--filter \"ClassName=Org.OpenAPITools.Test.$test\""
fi

# Overwrite the autogenerated tests with the manually written tests
$sudo_prefix rm -rf ./out/$appliance/csharp-netcore/src/Org.OpenAPITools.Test/Api
$sudo_prefix rm -rf ./out/$appliance/csharp-netcore/src/Org.OpenAPITools.Test/Model
$sudo_prefix cp -r ./test/csharp-netcore/* ./out/$appliance/csharp-netcore/src/Org.OpenAPITools.Test/
$sudo_prefix rm -rf ./out/$appliance/csharp/src/Org.OpenAPITools.Test/Api
$sudo_prefix rm -rf ./out/$appliance/csharp/src/Org.OpenAPITools.Test/Model
$sudo_prefix cp -r ./test/csharp/* ./out/$appliance/csharp/src/Org.OpenAPITools.Test/

docker run --rm --network $docker_network \
-v ${PWD}/out/${appliance}/csharp-netcore:/src \
-e CONJUR_HTTP_APPLIANCE_URL=http://conjur \
-v ${PWD}/out/${appliance}/csharp:/src \
-e CONJUR_HTTP_APPLIANCE_URL=http://conjur \
-e CONJUR_HTTPS_APPLIANCE_URL=https://conjur-https \
-e CONJUR_ACCOUNT=dev \
-e CONJUR_AUTHN_LOGIN=admin \
-e CONJUR_CA_BUNDLE=/opt/conjur-openapi-spec/config/https/ca.crt \
--env-file .env \
-w /src \
mcr.microsoft.com/dotnet/sdk:2.1 \
-w /src \
mcr.microsoft.com/dotnet/sdk:7.0 \
bash -c "dotnet test $test_params"
}

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ services:
- ./config/https/:/config

test-dotnet:
image: mcr.microsoft.com/dotnet/sdk:2.1
image: mcr.microsoft.com/dotnet/sdk:7.0
command: ['sleep', '999d']
depends_on:
- conjur
Expand Down
Loading

0 comments on commit ef53014

Please sign in to comment.