From 0ea5bdd6caebbd324b1f058850f2d4bd22c71bde Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 05:55:23 -0600 Subject: [PATCH 01/30] Building out files for E2E testing with example projects Signed-off-by: Whit Waldo --- .github/workflows/example-e2e-tests.json | 17 +++ .github/workflows/example-tests.yml | 128 +++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 .github/workflows/example-e2e-tests.json create mode 100644 .github/workflows/example-tests.yml diff --git a/.github/workflows/example-e2e-tests.json b/.github/workflows/example-e2e-tests.json new file mode 100644 index 000000000..ea2134def --- /dev/null +++ b/.github/workflows/example-e2e-tests.json @@ -0,0 +1,17 @@ +{ + "projects":[ + { + "project": "Cryptography.csproj", + "tests": { + "name": "Encrypt & Decrypt String", + "arguments": "0", + "expected_std_output": [ + "== APP == Original string value: 'This is the value we're going to encrypt today'", + "== APP == Encrypted bytes: '", + "== APP == Decrypted string: 'This is the value we're going to encrypt today'" + ], + "expectation_type": "startswith" + } + } + ] +} \ No newline at end of file diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml new file mode 100644 index 000000000..6b2dbe5d0 --- /dev/null +++ b/.github/workflows/example-tests.yml @@ -0,0 +1,128 @@ +name: example-integration-test + +on: + push: + branches: + - master + - release-* + tags: + - v* + + pull_request: + branches: + - master + - release-* + +jobs: + build: + name: run example-based integration tests + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + dotnet-version: ['8.0', '9.0'] + include: + - dotnet-version: '8.0' + display-name: '.NET 8.0' + framework: 'net8' + prefix: 'net8' + install-version: '8.0.x' + - dotnet-version: '9.0' + display-name: '.NET 9.0' + framework: 'net9' + prefix: 'net9' + install-version: '9.0.x' + env: + NUPKG_OUTDIR: bin/Release/nugets + GOVER: 1.20.0 + GOOS: linux + GOARCH: amd64 + GOPROXY: https://proxy.golang.org + DAPR_CLI_VER: 1.14.0 + DAPR_RUNTIME_VER: 1.14.0 + DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.14/install/install.sh + DAPR_CLI_REF: '' + steps: + - name: Set up Dapr CLI + run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }} + - name: Checkout Dapr CLI repo to override dapr command. + uses: actions/checkout@v2 + if: env.DAPR_CLI_REF != '' + with: + repository: dapr/cli + ref: ${{ env.DAPR_CLI_REF }} + path: cli + - name: Checkout Dapr repo to override daprd. + uses: actions/checkout@v2 + if: env.DAPR_REF != '' + with: + repository: dapr/dapr + ref: ${{ env.DAPR_REF }} + path: dapr + - name: Set up Go from dapr/go.mod + if: env.DAPR_REF != '' + uses: actions/setup-go@v3 + with: + go-version-file: "dapr/go.mod" + - name: Set up Go from cli/go.mod + if: env.DAPR_REF == '' && env.DAPR_CLI_REF != '' + uses: actions/setup-go@v3 + with: + go-version-file: "cli/go.mod" + - name: Build and override dapr cli with referenced commit. + if: env.DAPR_CLI_REF != '' + run: | + cd cli + make + sudo cp dist/linux_amd64/release/dapr /usr/local/bin/dapr + cd .. + - name: Initialize Dapr runtime ${{ env.DAPR_RUNTIME_VER }} + run: | + dapr uninstall --all + dapr init --runtime-version ${{ env.DAPR_RUNTIME_VER }} + - name: Build and override daprd with referenced commit. + if: env.DAPR_REF != '' + run: | + cd dapr + make + mkdir -p $HOME/.dapr/bin/ + cp dist/linux_amd64/release/daprd $HOME/.dapr/bin/daprd + cd .. + - name: Override placement service. + if: env.DAPR_REF != '' + run: | + docker stop dapr_placement + cd dapr + ./dist/linux_amd64/release/placement & + - uses: actions/checkout@v1 + - name: Parse release version + run: python ./.github/scripts/get_release_version.py + - name: Setup ${{ matrix.display-name }} + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ matrix.install-version }} + dotnet-quality: 'ga' # Prefer a GA release, but use the RC if not available + - name: Setup .NET 8 (required) + uses: actions/setup-dotnet@v3 + if: ${{ matrix.install-version != '8.0.x' }} + with: + dotnet-version: '8.0.x' + dotnet-quality: 'ga' + - name: Setup .NET 9 (required) + uses: actions/setup-dotnet@v3 + if: ${{ matrix.install-version != '9.0.x' }} + with: + dotnet-version: '9.0.x' + dotnet-quality: 'ga' + - name: Install dependencies + run: dotnet restore + - name: Build & test projects + # disable deterministic builds, just for test run. Deterministic builds break coverage for some reason + run: | + for project in $(find . -name '*.csproj'); do + echo "Building and testing $project with .NET ${{matrix.dotnet-version}}" + dotnet build $project --configuration Release /p:GITHUB_ACTIONS=false + dotnet run --project $project -- 0 + + + \ No newline at end of file From 3a776c161cc9a8447622f84b5bceb720104e4b60 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 15:43:27 -0600 Subject: [PATCH 02/30] Building out additional integration tests action to run against all the example projects Added tests to the test metadata file 'example-e2e-tests.json' Signed-off-by: Whit Waldo --- .github/workflows/example-e2e-tests.json | 92 +++++++++++++++++++++--- .github/workflows/example-tests.yml | 67 +++++++++++++++-- 2 files changed, 143 insertions(+), 16 deletions(-) diff --git a/.github/workflows/example-e2e-tests.json b/.github/workflows/example-e2e-tests.json index ea2134def..993079731 100644 --- a/.github/workflows/example-e2e-tests.json +++ b/.github/workflows/example-e2e-tests.json @@ -2,16 +2,88 @@ "projects":[ { "project": "Cryptography.csproj", - "tests": { - "name": "Encrypt & Decrypt String", - "arguments": "0", - "expected_std_output": [ - "== APP == Original string value: 'This is the value we're going to encrypt today'", - "== APP == Encrypted bytes: '", - "== APP == Decrypted string: 'This is the value we're going to encrypt today'" - ], - "expectation_type": "startswith" - } + "tests": [ + { + "name": "Encrypt & Decrypt String", + "arguments": "0", + "expected_std_output": [ + "== APP == Original string value: 'This is the value we're going to encrypt today'", + "== APP == Encrypted bytes: '", + "== APP == Decrypted string: 'This is the value we're going to encrypt today'" + ], + "expectation_type": "startswith" + }, + { + "name": "Encrypt & Decrypt Small File Stream", + "arguments": "1", + "expected_std_output": [ + "== APP == Original file contents:", + "== APP == # The Road Not Taken", + "== APP == ## By Robert Lee Frost", + "== APP == ", + "== APP == Two roads diverged in a yellow wood,", + "== APP == And sorry I could not travel both", + "== APP == And be one traveler, long I stood", + "== APP == And looked down one as far as I could", + "== APP == To where it bent in the undergrowth;", + "== APP == ", + "== APP == Then took the other, as just as fair", + "== APP == And having perhaps the better claim,", + "== APP == Because it was grassy and wanted wear;", + "== APP == Though as for that, the passing there", + "== APP == Had worn them really about the same,", + "== APP == ", + "== APP == And both that morning equally lay", + "== APP == In leaves no step had trodden black", + "== APP == Oh, I kept the first for another day!", + "== APP == Yet knowing how way leads on to way,", + "== APP == I doubted if I should ever come back.", + "== APP == ", + "== APP == I shall be telling this with a sigh", + "== APP == Somewhere ages and ages hence:", + "== APP == Two roads diverged in a wood, and I,", + "== APP == I took the one less traveled by,", + "== APP == And that has made all the difference.", + "== APP == ", + "== APP == Encrypted bytes: ZGFwci5pby9lbmMvdjEKeyJrdyI6NSwid2ZrIjoiVHRRUnNneVkyMDlQZGxaZkNxcW11UC9OQlRra1plajZ2c2tGbG1nN21uSUFtZlZ3R3YxYVhVajlyMGdCb1Q4UWh3SWZJNzNUdVc0WkFjQmlhK2V1QStPelBQQkdYbWpZYmhFQlZLandTTkNRa3l1TFVWZ0d4ZUJwbm03cDA2bHFFUkV6MGpRL0NiNnFPN0ZKc1Z0ZVh6dmF4dDFBK0dtSEVEd0ZLYmtydGZOaU", + "1aeHF2bS85Y0pOTVBpNm9Zcms1eGJkK1kwcmc5bU9vZ1hmL1RidW5IUWRvc3lhSGpzc082U0l3TVUzdVdIMEdIZEFzNU95ZEhCRDdhd0kvSFFXdzEya3c4ZGNOQzd4enFPd0RGSUh1NXc3cmx1aGZmZHZCeVBoWDNwMEdBQzR6eWtvY2dUOWdBcGF0VjV4ekFjRXBGVGdycUxGdXhDSWI1dG9veUZxZ25ESnVYYktLWWxSU2hkclhBeGJnbFVBOVQxVmFMUC9hakhGaEYwTEFwajhYM2dYUXo2RDhhSUE", + "zRlM4VEJPYTUrSDR5cXkyQzk4dzhZMUFFcS9vSzI4dVB3NFROUEttUUxwb0xUeFE3VzRya3drbDRLcy9ZdExXYnRpU2pUSUN1ODNYaXB4T1JsU0w4SmQwQjU0MG14dDlqTDJOZlBJK09QV0l0VzdtWTJVcWh1bGxWWGNoODNscCs0V01OZ2tVRjJraElGRVFlSkhEakpkdTJRZGRGQXdZVDd5S3RPem5MdktYRHFQRXgwMk5mODU3NlpNS0VCb0ZXdDZuU084ZGxXSEFPMCtsbFZEbUZrRnIyRTVUMVpl", + "UlppSGJMd21zanpzNlU5SkoxTENDaUg3VWk4WGNkN1gzZEgzaDV0LzJTWWRCSStWUENiZW42dDFJYlJxVVNMOXc9IiwiY3BoIjoxLCJucCI6Ik9NUTFRcHJHUHc9PSJ9Cnh0YzBGalluaEdRMmo2eXJLVTI3aEtBbTJtTkJaZCtwb1hUZTUwLzRiYW89CkIYDF5TkccFoiifujAE/TTDwaJCj3s1HQv2uaGpvg2+8xUwIgvfBD4C+Qxk6UObPNkGFSgUx+jhQcNt7zaBoAGw+x2bUmNHrxy0HjIk/nPKa", + "LasVRWyoNvNaqAHrn2yaxRzG7TggigJP6IenC1p40CvIZRPnr7RpjxoZrTeD5DKzrYB7IjCNF3PJ7lye3sw7F65/1HzF0nCGjZPZAfZUIItd8Q5jblh2y5RSrdCxZyLIMgsoHKDSSa+G1WHI9V4oYnduHFGt9c+uAsl103+/Q1JrPzZiMtvI1AVYl364CuhflUaqw/SQ4wrpfnjIZNNVhfItFAQcuNUxsQWz4rGyJDLwagLReCyP9dFJWCsUjuNK/9y+c+W2oK0xhmn0EOw7aMGpslsTb2jL+bClJAzme", + "/mVRpM294B97AabFhydlPUGV1ZTmQOo8q1ApuKfzIyG8ucMTYnssTbjW0V6038QTCIPpP97H1BGON3JjYBCtOQNI6FUhEHLfyrBcx0eWZ/QhxB0tywD7d+DWtnSx3Y4OBE7KjvLrEyaOQAlOspk4rhZBpub/g+yjc7T1q+HY+mBR6sHfSuLrFmyMEcOqgxBVaJPD0dWizhB/dTW6cVLVmXWWi9jJglMDF92wUi68c/5spEyNRJRabv1sEq4VJ2OJtRJlCvzWFfqrrw9ZjJSEoaLMqZjiLU9HyXB2VFTLM", + "PrzJFSdZO3ajViWbnrSqNZy/CBTEnKmGsr1E8LRSfXm/PpGrvo0OL3VZC+P8IxuCK43Qug1Qoymkc1K0i6UbzeLvyMuv3J11KKhQCss9+/O8GKqkRCWa/D2TCJ6RiG20+N/bBdv0T6AQK0RcAMj6RQt3WJlnFQ4OtrVTHKNnZCoQZbBid0u0UvccFWAbkm/Tk0IVUbMcEv5pFS64h7ePkbHo5ZEaoobXwpmzXrx6a+P41OkNokIcE28A06RIqMmRUpE4uA9vje+M0xv5fpB64qoUqSW0DXFwDCVDW21O12kl1PJcU4aLdc9FOk7T5cA/PdYLJSjAo6P4J5VEIRv8xakH5X4a8hYz+BWcfH3pdcfZRLnZsU9UGMIcaiLZsB/I=", + "== APP == ", + "== APP == Decrypted value: ", + "== APP == # The Road Not Taken", + "== APP == ## By Robert Lee Frost", + "== APP == ", + "== APP == Two roads diverged in a yellow wood,", + "== APP == And sorry I could not travel both", + "== APP == And be one traveler, long I stood", + "== APP == And looked down one as far as I could", + "== APP == To where it bent in the undergrowth;", + "== APP == ", + "== APP == Then took the other, as just as fair", + "== APP == And having perhaps the better claim,", + "== APP == Because it was grassy and wanted wear;", + "== APP == Though as for that, the passing there", + "== APP == Had worn them really about the same,", + "== APP == ", + "== APP == And both that morning equally lay", + "== APP == In leaves no step had trodden black", + "== APP == Oh, I kept the first for another day!", + "== APP == Yet knowing how way leads on to way,", + "== APP == I doubted if I should ever come back.", + "== APP == ", + "== APP == I shall be telling this with a sigh", + "== APP == Somewhere ages and ages hence:", + "== APP == Two roads diverged in a wood, and I,", + "== APP == I took the one less traveled by,", + "== APP == And that has made all the difference." + ], + "expectation_type": "startswith" + } + ] } ] } \ No newline at end of file diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 6b2dbe5d0..a03340d1d 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -14,12 +14,14 @@ on: - release-* jobs: - build: + build-and-test: name: run example-based integration tests - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: fail-fast: false matrix: + os: [ubuntu-latest] dotnet-version: ['8.0', '9.0'] include: - dotnet-version: '8.0' @@ -32,6 +34,7 @@ jobs: framework: 'net9' prefix: 'net9' install-version: '9.0.x' + env: NUPKG_OUTDIR: bin/Release/nugets GOVER: 1.20.0 @@ -116,13 +119,65 @@ jobs: dotnet-quality: 'ga' - name: Install dependencies run: dotnet restore + - name: Check test coverage + run: | + if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then + sudo apt-get install jq + else + choco install jq + fi + # Find all .csproj files in the ./examples directory + all_projects=$(find ./examples -name '*.csproj' -exec basename {} \; | sed 's/.csproj//') + # Get the list of projects from the 'example-e2e-tests.json' file + tested_projects=$(jq -r '.projects[].project' example-e2e-tests.json | sed s/.csproj//') + # Compare the lists and find projects without tests + for project in $all_projects; do + if ! echo "$tested_projects" | grep -q "$project"; then + echo "Project $project does not have any tests in example-e2e-test.json" + fi + done - name: Build & test projects # disable deterministic builds, just for test run. Deterministic builds break coverage for some reason run: | - for project in $(find . -name '*.csproj'); do - echo "Building and testing $project with .NET ${{matrix.dotnet-version}}" - dotnet build $project --configuration Release /p:GITHUB_ACTIONS=false - dotnet run --project $project -- 0 + projects=$(jq -c '.projects[]' example-e2e-tests.json) + for project in $projects; do + project_name=$(echo $project | jq -r '.project') + + # Find the .csproj file in the ./examples directory + csproj_path=$(find ./examples -name "$project_name") + + tests=$(echo $project | jq -c '.tests[]') + for test in $tests; do + test_name=$(echo $test | jq -r '.name') + args=$(echo $test | jq -r '.arguments') + expectedOutputs=$(echo $test | jq -r '.expected_std_output[]') + expectation_type=$(echo $test | jq -r '.expectation_type') + + echo "Building and testing $project with .NET ${{matrix.dotnet-version}}" + dotnet build $csproj_path --configuration Release /p:GITHUB_ACTIONS=false + output=$(dotnet run --project $csproj_path -- $args) + + for expected in $expectedOutputs; do + if [[ "$expectation_type" == "startswith" ]]; then + if [[ "$output" != "$expected"* ]]; then + echo "Test failed for $csproj_path with .NET ${{ matrix.dotnet-version }}: Expected '$expected' not found in output" + exit 1 + fi + elif [[ "$expectation_type" == "equals" ]]; then + if [[ "$output" != "$expected" ]]; then + echo "Test failed for $csproj_path with .NET ${{matrix.dotnet-version }}: Expected '$expected' not found in output" + exit 1 + fi + else + if [[ "$output" != *"$expected"* ]]; then + echo "Test failed for $csproj_path with .NET ${{ matrix.dotnet-version }}: Expected '$expected' not found in output" + exit 1 + fi + fi + done + done + done + \ No newline at end of file From cd70284574bdbe6c33d2615f9251bc8b9781f12e Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 15:58:04 -0600 Subject: [PATCH 03/30] Tweak to use 'stdout' instead of 'std' leaving open the possibility to validate 'stderr' messages at some future point Signed-off-by: Whit Waldo --- .github/workflows/example-e2e-tests.json | 4 ++-- .github/workflows/example-tests.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/example-e2e-tests.json b/.github/workflows/example-e2e-tests.json index 993079731..1a1788611 100644 --- a/.github/workflows/example-e2e-tests.json +++ b/.github/workflows/example-e2e-tests.json @@ -6,7 +6,7 @@ { "name": "Encrypt & Decrypt String", "arguments": "0", - "expected_std_output": [ + "expected_stdout_output": [ "== APP == Original string value: 'This is the value we're going to encrypt today'", "== APP == Encrypted bytes: '", "== APP == Decrypted string: 'This is the value we're going to encrypt today'" @@ -16,7 +16,7 @@ { "name": "Encrypt & Decrypt Small File Stream", "arguments": "1", - "expected_std_output": [ + "expected_stdout_output": [ "== APP == Original file contents:", "== APP == # The Road Not Taken", "== APP == ## By Robert Lee Frost", diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index a03340d1d..b05a01933 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -150,7 +150,7 @@ jobs: for test in $tests; do test_name=$(echo $test | jq -r '.name') args=$(echo $test | jq -r '.arguments') - expectedOutputs=$(echo $test | jq -r '.expected_std_output[]') + expectedOutputs=$(echo $test | jq -r '.expected_stdout_output[]') expectation_type=$(echo $test | jq -r '.expectation_type') echo "Building and testing $project with .NET ${{matrix.dotnet-version}}" From 5fd376d6b1e4bccfe902fde8f934c2aa79156aa5 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 16:01:05 -0600 Subject: [PATCH 04/30] Fixed file name Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index b05a01933..9aa86eec2 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -128,14 +128,15 @@ jobs: fi # Find all .csproj files in the ./examples directory all_projects=$(find ./examples -name '*.csproj' -exec basename {} \; | sed 's/.csproj//') - # Get the list of projects from the 'example-e2e-tests.json' file - tested_projects=$(jq -r '.projects[].project' example-e2e-tests.json | sed s/.csproj//') + # Get the list of projects from example-e2e-tests.json + tested_projects=$(jq -r '.projects[].project' example-e2e-tests.json | sed 's/.csproj//') # Compare the lists and find projects without tests for project in $all_projects; do if ! echo "$tested_projects" | grep -q "$project"; then - echo "Project $project does not have any tests in example-e2e-test.json" + echo "Project $project does not have any tests in example-e2e-tests.json" fi done + - name: Build & test projects # disable deterministic builds, just for test run. Deterministic builds break coverage for some reason run: | @@ -177,7 +178,3 @@ jobs: done done done - - - - \ No newline at end of file From ae1f250c0913196d4106ecc9bed0e0bc7a0b2933 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 16:04:46 -0600 Subject: [PATCH 05/30] Updated path to example-e2e-tests.json file relative to root working directory Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 9aa86eec2..a62780a4b 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -129,7 +129,7 @@ jobs: # Find all .csproj files in the ./examples directory all_projects=$(find ./examples -name '*.csproj' -exec basename {} \; | sed 's/.csproj//') # Get the list of projects from example-e2e-tests.json - tested_projects=$(jq -r '.projects[].project' example-e2e-tests.json | sed 's/.csproj//') + tested_projects=$(jq -r '.projects[].project' ./.github/workflows/example-e2e-tests.json | sed 's/.csproj//') # Compare the lists and find projects without tests for project in $all_projects; do if ! echo "$tested_projects" | grep -q "$project"; then @@ -140,7 +140,7 @@ jobs: - name: Build & test projects # disable deterministic builds, just for test run. Deterministic builds break coverage for some reason run: | - projects=$(jq -c '.projects[]' example-e2e-tests.json) + projects=$(jq -c '.projects[]' ./.github/workflows/example-e2e-tests.json) for project in $projects; do project_name=$(echo $project | jq -r '.project') From fe3106dbabe6936f2d470c2da17044cf940e750e Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 16:15:18 -0600 Subject: [PATCH 06/30] Added some debug logic to see what's going on with reading the JSON file Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index a62780a4b..2bb250667 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -140,12 +140,21 @@ jobs: - name: Build & test projects # disable deterministic builds, just for test run. Deterministic builds break coverage for some reason run: | + # Debug: Print the contents of the JSON file + echo "Contents of example-e2e-tests.json" + cat ./.github/workflows/example-e2e-tests.json + + # Debug: Validate the JSON file + echo "Validating JSON file with jq:" + jq . ./.github/workflows/example-e2e-tests.json + + # Parse the projects projects=$(jq -c '.projects[]' ./.github/workflows/example-e2e-tests.json) for project in $projects; do project_name=$(echo $project | jq -r '.project') # Find the .csproj file in the ./examples directory - csproj_path=$(find ./examples -name "$project_name") + csproj_path=$(find ./examples -name '$project_name') tests=$(echo $project | jq -c '.tests[]') for test in $tests; do From 352867038a8417b4e3ad728c849b1e3b1e83f453 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 16:20:35 -0600 Subject: [PATCH 07/30] Shifting debug logic Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 2bb250667..453ac2f4d 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -22,7 +22,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - dotnet-version: ['8.0', '9.0'] + dotnet-version: ['8.0'] #, '9.0'] include: - dotnet-version: '8.0' display-name: '.NET 8.0' @@ -139,17 +139,16 @@ jobs: - name: Build & test projects # disable deterministic builds, just for test run. Deterministic builds break coverage for some reason - run: | - # Debug: Print the contents of the JSON file - echo "Contents of example-e2e-tests.json" - cat ./.github/workflows/example-e2e-tests.json - + run: | # Debug: Validate the JSON file echo "Validating JSON file with jq:" jq . ./.github/workflows/example-e2e-tests.json # Parse the projects projects=$(jq -c '.projects[]' ./.github/workflows/example-e2e-tests.json) + echo "Parsed projects:" + echo "$projects". + for project in $projects; do project_name=$(echo $project | jq -r '.project') From e7d091d47b9b4f62a182bed4bc99b55b4dd0e734 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 16:26:49 -0600 Subject: [PATCH 08/30] Updated tests run-on value Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 453ac2f4d..a26e9f0bc 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: ['ubuntu-latest'] dotnet-version: ['8.0'] #, '9.0'] include: - dotnet-version: '8.0' From 724b5ac3f3f226b7759c512ceaf9dc9504c1ef48 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 16:28:41 -0600 Subject: [PATCH 09/30] Reordered runs-on section Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index a26e9f0bc..067bb0008 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -16,7 +16,6 @@ on: jobs: build-and-test: name: run example-based integration tests - runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -35,6 +34,8 @@ jobs: prefix: 'net9' install-version: '9.0.x' + runs-on: ${{ matrix.os }} + env: NUPKG_OUTDIR: bin/Release/nugets GOVER: 1.20.0 From 3a157801858f5ddc4d87abf6ac22067beacb7d6d Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 16:31:36 -0600 Subject: [PATCH 10/30] Using strictly ubuntu-latest for now Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 067bb0008..a851e8fa1 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -34,7 +34,7 @@ jobs: prefix: 'net9' install-version: '9.0.x' - runs-on: ${{ matrix.os }} + runs-on: 'ubuntu-latest' env: NUPKG_OUTDIR: bin/Release/nugets From 8241bb434d8da38c25e2aec800617c451cd88f71 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 16:41:04 -0600 Subject: [PATCH 11/30] Removed windows install option Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index a851e8fa1..efaf7b9b7 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -122,11 +122,12 @@ jobs: run: dotnet restore - name: Check test coverage run: | - if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then - sudo apt-get install jq - else - choco install jq - fi + +# if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then + sudo apt-get install jq +# else +# choco install jq +# fi # Find all .csproj files in the ./examples directory all_projects=$(find ./examples -name '*.csproj' -exec basename {} \; | sed 's/.csproj//') # Get the list of projects from example-e2e-tests.json From b950d24492c2ddf922e179fb456c19f586c0647e Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 16:45:36 -0600 Subject: [PATCH 12/30] Fixed run script Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index efaf7b9b7..494f0a9cb 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -122,12 +122,7 @@ jobs: run: dotnet restore - name: Check test coverage run: | - -# if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then sudo apt-get install jq -# else -# choco install jq -# fi # Find all .csproj files in the ./examples directory all_projects=$(find ./examples -name '*.csproj' -exec basename {} \; | sed 's/.csproj//') # Get the list of projects from example-e2e-tests.json From afa3458dba0dc8f0467e85a85211bd861edc15bf Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 16:53:25 -0600 Subject: [PATCH 13/30] Narrowing debug logic Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 494f0a9cb..416d308ba 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -144,7 +144,7 @@ jobs: # Parse the projects projects=$(jq -c '.projects[]' ./.github/workflows/example-e2e-tests.json) echo "Parsed projects:" - echo "$projects". + echo "$projects" | jq -r '.project' for project in $projects; do project_name=$(echo $project | jq -r '.project') From 03af6b3ad69c619998d8c4c16db674bf28926b95 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 16:57:08 -0600 Subject: [PATCH 14/30] Added more debug text Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 416d308ba..8da87dd91 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -136,11 +136,7 @@ jobs: - name: Build & test projects # disable deterministic builds, just for test run. Deterministic builds break coverage for some reason - run: | - # Debug: Validate the JSON file - echo "Validating JSON file with jq:" - jq . ./.github/workflows/example-e2e-tests.json - + run: | # Parse the projects projects=$(jq -c '.projects[]' ./.github/workflows/example-e2e-tests.json) echo "Parsed projects:" @@ -148,18 +144,26 @@ jobs: for project in $projects; do project_name=$(echo $project | jq -r '.project') + echo "Project name:" + echo "$project_name" # Find the .csproj file in the ./examples directory csproj_path=$(find ./examples -name '$project_name') + echo "csproj path:" + echo "$csproj_path" tests=$(echo $project | jq -c '.tests[]') for test in $tests; do test_name=$(echo $test | jq -r '.name') + echo "test name:" + echo "$test_name" args=$(echo $test | jq -r '.arguments') + echo 'args:' + echo '$args' expectedOutputs=$(echo $test | jq -r '.expected_stdout_output[]') expectation_type=$(echo $test | jq -r '.expectation_type') - echo "Building and testing $project with .NET ${{matrix.dotnet-version}}" + echo "Building and testing $project with .NET ${{ matrix.dotnet-version }}" dotnet build $csproj_path --configuration Release /p:GITHUB_ACTIONS=false output=$(dotnet run --project $csproj_path -- $args) From f76bd3d296d9f8b2ef22547df948c65769f49ec5 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 17:03:35 -0600 Subject: [PATCH 15/30] Changing script style to reflect how jq is reading the arrays so they can be iterated over Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 8da87dd91..f2e84d617 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -139,27 +139,24 @@ jobs: run: | # Parse the projects projects=$(jq -c '.projects[]' ./.github/workflows/example-e2e-tests.json) - echo "Parsed projects:" + echo "Parsed project names:" echo "$projects" | jq -r '.project' - for project in $projects; do + # Iterate over the projects + echo "$projects" | while read project; do project_name=$(echo $project | jq -r '.project') - echo "Project name:" - echo "$project_name" + echo "Project name: $project_name" # Find the .csproj file in the ./examples directory csproj_path=$(find ./examples -name '$project_name') - echo "csproj path:" - echo "$csproj_path" + echo "csproj path: $csproj_path" tests=$(echo $project | jq -c '.tests[]') - for test in $tests; do + echo "$tests" | while read test; do test_name=$(echo $test | jq -r '.name') - echo "test name:" - echo "$test_name" + echo "test name: $test_name" args=$(echo $test | jq -r '.arguments') - echo 'args:' - echo '$args' + echo 'args: $args' expectedOutputs=$(echo $test | jq -r '.expected_stdout_output[]') expectation_type=$(echo $test | jq -r '.expectation_type') From 6053d40f56ee204710333c1c70a6a9c56efdbafc Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 17:32:01 -0600 Subject: [PATCH 16/30] Minor tweak to find statement Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index f2e84d617..4e2d315cb 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -148,7 +148,7 @@ jobs: echo "Project name: $project_name" # Find the .csproj file in the ./examples directory - csproj_path=$(find ./examples -name '$project_name') + csproj_path=$(find ./examples/ -name $project_name) echo "csproj path: $csproj_path" tests=$(echo $project | jq -c '.tests[]') From 7e7966809f3ef191f99dba919e750d6591d9e771 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 17:36:58 -0600 Subject: [PATCH 17/30] Removed extraneous .NET install steps Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 4e2d315cb..fbc598cd2 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -106,18 +106,6 @@ jobs: with: dotnet-version: ${{ matrix.install-version }} dotnet-quality: 'ga' # Prefer a GA release, but use the RC if not available - - name: Setup .NET 8 (required) - uses: actions/setup-dotnet@v3 - if: ${{ matrix.install-version != '8.0.x' }} - with: - dotnet-version: '8.0.x' - dotnet-quality: 'ga' - - name: Setup .NET 9 (required) - uses: actions/setup-dotnet@v3 - if: ${{ matrix.install-version != '9.0.x' }} - with: - dotnet-version: '9.0.x' - dotnet-quality: 'ga' - name: Install dependencies run: dotnet restore - name: Check test coverage @@ -155,8 +143,8 @@ jobs: echo "$tests" | while read test; do test_name=$(echo $test | jq -r '.name') echo "test name: $test_name" - args=$(echo $test | jq -r '.arguments') - echo 'args: $args' + arguments=$(echo $test | jq -r '.arguments') + echo 'args: $arguments' expectedOutputs=$(echo $test | jq -r '.expected_stdout_output[]') expectation_type=$(echo $test | jq -r '.expectation_type') From d6fed27a399d5792676b2c6eec1010bc48a09ab7 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 17:37:46 -0600 Subject: [PATCH 18/30] Updated arguments variable name Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index fbc598cd2..4d18a1b8c 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -150,7 +150,7 @@ jobs: echo "Building and testing $project with .NET ${{ matrix.dotnet-version }}" dotnet build $csproj_path --configuration Release /p:GITHUB_ACTIONS=false - output=$(dotnet run --project $csproj_path -- $args) + output=$(dotnet run --project $csproj_path -- $arguments) for expected in $expectedOutputs; do if [[ "$expectation_type" == "startswith" ]]; then From 3259f617ba4fb1ad10b3859fead3f837758117c1 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 17:40:48 -0600 Subject: [PATCH 19/30] Added specific framework to 'dotnet run' command Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 4d18a1b8c..9518356d3 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -150,7 +150,7 @@ jobs: echo "Building and testing $project with .NET ${{ matrix.dotnet-version }}" dotnet build $csproj_path --configuration Release /p:GITHUB_ACTIONS=false - output=$(dotnet run --project $csproj_path -- $arguments) + output=$(dotnet run --project $csproj_path --framework ${{ matrix.framework }} -- $arguments) for expected in $expectedOutputs; do if [[ "$expectation_type" == "startswith" ]]; then From 22787c9c272bea3930a1add9f57c0dc8bc550a2e Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 17:42:32 -0600 Subject: [PATCH 20/30] Removed unnecessary dotnet restore step Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 9518356d3..a6ad0ebc8 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -106,8 +106,6 @@ jobs: with: dotnet-version: ${{ matrix.install-version }} dotnet-quality: 'ga' # Prefer a GA release, but use the RC if not available - - name: Install dependencies - run: dotnet restore - name: Check test coverage run: | sudo apt-get install jq From 8c2316f1fb4733e6fc0590574f8310d816288a88 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 17:49:53 -0600 Subject: [PATCH 21/30] Removed prefix from matrix as it's not necessary, updated framework to make it match the expected value to pass into dotnet run statement as --framework Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index a6ad0ebc8..42031a600 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -25,13 +25,11 @@ jobs: include: - dotnet-version: '8.0' display-name: '.NET 8.0' - framework: 'net8' - prefix: 'net8' + framework: 'net8.0' install-version: '8.0.x' - dotnet-version: '9.0' display-name: '.NET 9.0' - framework: 'net9' - prefix: 'net9' + framework: 'net9.0' install-version: '9.0.x' runs-on: 'ubuntu-latest' From 2360c4491ff9b0ff10f1a03e71a8f5ba7b03cf28 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 17:51:47 -0600 Subject: [PATCH 22/30] Simplified debug output Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 42031a600..8fb7cbfd4 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -144,7 +144,7 @@ jobs: expectedOutputs=$(echo $test | jq -r '.expected_stdout_output[]') expectation_type=$(echo $test | jq -r '.expectation_type') - echo "Building and testing $project with .NET ${{ matrix.dotnet-version }}" + echo "Building and testing $project_name with .NET ${{ matrix.dotnet-version }}" dotnet build $csproj_path --configuration Release /p:GITHUB_ACTIONS=false output=$(dotnet run --project $csproj_path --framework ${{ matrix.framework }} -- $arguments) From 90193ec014db84c52b85e892808e6a4738e413f0 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 17:58:05 -0600 Subject: [PATCH 23/30] Added specific .NET framework to dotnet build operation as well Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 8fb7cbfd4..96d44a518 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -145,7 +145,7 @@ jobs: expectation_type=$(echo $test | jq -r '.expectation_type') echo "Building and testing $project_name with .NET ${{ matrix.dotnet-version }}" - dotnet build $csproj_path --configuration Release /p:GITHUB_ACTIONS=false + dotnet build $csproj_path --framework ${{ matrix.framework }} --configuration Release /p:GITHUB_ACTIONS=false output=$(dotnet run --project $csproj_path --framework ${{ matrix.framework }} -- $arguments) for expected in $expectedOutputs; do From 89238162b45af01206d6361399df8ac0103539af Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 19:01:22 -0600 Subject: [PATCH 24/30] Added .NET 8 and .NET 9 as valid targets Signed-off-by: Whit Waldo --- examples/Client/Cryptography/Cryptography.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Client/Cryptography/Cryptography.csproj b/examples/Client/Cryptography/Cryptography.csproj index 525c38562..ae89a09ed 100644 --- a/examples/Client/Cryptography/Cryptography.csproj +++ b/examples/Client/Cryptography/Cryptography.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net6.0;net8.0;net9.0 enable enable latest From eae1621bf2c62c332e9ef2fb805d52a0564f42fb Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 19:05:16 -0600 Subject: [PATCH 25/30] Removed string test as it is known to break right now Signed-off-by: Whit Waldo --- .github/workflows/example-e2e-tests.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/example-e2e-tests.json b/.github/workflows/example-e2e-tests.json index 1a1788611..40aa5b05a 100644 --- a/.github/workflows/example-e2e-tests.json +++ b/.github/workflows/example-e2e-tests.json @@ -3,16 +3,6 @@ { "project": "Cryptography.csproj", "tests": [ - { - "name": "Encrypt & Decrypt String", - "arguments": "0", - "expected_stdout_output": [ - "== APP == Original string value: 'This is the value we're going to encrypt today'", - "== APP == Encrypted bytes: '", - "== APP == Decrypted string: 'This is the value we're going to encrypt today'" - ], - "expectation_type": "startswith" - }, { "name": "Encrypt & Decrypt Small File Stream", "arguments": "1", From b6c654cc338ed18079c80371852cba51fb3361c3 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 19:14:32 -0600 Subject: [PATCH 26/30] Updating crypto example to use smallfile and improve reference Signed-off-by: Whit Waldo --- examples/Client/Cryptography/Cryptography.csproj | 2 +- .../Cryptography/Examples/EncryptDecryptFileStreamExample.cs | 2 +- examples/Client/Cryptography/{file.txt => smallfile.txt} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename examples/Client/Cryptography/{file.txt => smallfile.txt} (100%) diff --git a/examples/Client/Cryptography/Cryptography.csproj b/examples/Client/Cryptography/Cryptography.csproj index ae89a09ed..f63da1e1f 100644 --- a/examples/Client/Cryptography/Cryptography.csproj +++ b/examples/Client/Cryptography/Cryptography.csproj @@ -17,7 +17,7 @@ - + PreserveNewest diff --git a/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs b/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs index 19df06345..f3c8f1073 100644 --- a/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs +++ b/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs @@ -25,7 +25,7 @@ public override async Task RunAsync(CancellationToken cancellationToken) using var client = new DaprClientBuilder().Build(); // The name of the file we're using as an example - const string fileName = "file.txt"; + const string fileName = "./smallfile.txt"; Console.WriteLine("Original file contents:"); foreach (var line in await File.ReadAllLinesAsync(fileName, cancellationToken)) diff --git a/examples/Client/Cryptography/file.txt b/examples/Client/Cryptography/smallfile.txt similarity index 100% rename from examples/Client/Cryptography/file.txt rename to examples/Client/Cryptography/smallfile.txt From 3b302b7389a800282b434f9407948e745b20c98b Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 19:17:58 -0600 Subject: [PATCH 27/30] Updated argument name again Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index 96d44a518..d652fe0ff 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -139,14 +139,14 @@ jobs: echo "$tests" | while read test; do test_name=$(echo $test | jq -r '.name') echo "test name: $test_name" - arguments=$(echo $test | jq -r '.arguments') - echo 'args: $arguments' + test_arguments=$(echo $test | jq -r '.arguments') + echo 'args: $test_arguments' expectedOutputs=$(echo $test | jq -r '.expected_stdout_output[]') expectation_type=$(echo $test | jq -r '.expectation_type') echo "Building and testing $project_name with .NET ${{ matrix.dotnet-version }}" dotnet build $csproj_path --framework ${{ matrix.framework }} --configuration Release /p:GITHUB_ACTIONS=false - output=$(dotnet run --project $csproj_path --framework ${{ matrix.framework }} -- $arguments) + output=$(dotnet run --project $csproj_path --framework ${{ matrix.framework }} -- $test_arguments) for expected in $expectedOutputs; do if [[ "$expectation_type" == "startswith" ]]; then From 692954469d7d14cd2f668a65ece1384a80eb5d72 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 19:20:43 -0600 Subject: [PATCH 28/30] Improving debug data Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index d652fe0ff..ae7675b3d 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -143,6 +143,7 @@ jobs: echo 'args: $test_arguments' expectedOutputs=$(echo $test | jq -r '.expected_stdout_output[]') expectation_type=$(echo $test | jq -r '.expectation_type') + echo 'expectation_type: $expectation_type' echo "Building and testing $project_name with .NET ${{ matrix.dotnet-version }}" dotnet build $csproj_path --framework ${{ matrix.framework }} --configuration Release /p:GITHUB_ACTIONS=false From 1e3d8b5af3544fbc1f64c8314ac2557d67287c8d Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 19:24:36 -0600 Subject: [PATCH 29/30] Switched to double quotes Signed-off-by: Whit Waldo --- .github/workflows/example-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/example-tests.yml b/.github/workflows/example-tests.yml index ae7675b3d..7de2ecffb 100644 --- a/.github/workflows/example-tests.yml +++ b/.github/workflows/example-tests.yml @@ -140,10 +140,10 @@ jobs: test_name=$(echo $test | jq -r '.name') echo "test name: $test_name" test_arguments=$(echo $test | jq -r '.arguments') - echo 'args: $test_arguments' + echo "args: $test_arguments" expectedOutputs=$(echo $test | jq -r '.expected_stdout_output[]') expectation_type=$(echo $test | jq -r '.expectation_type') - echo 'expectation_type: $expectation_type' + echo "expectation_type: $expectation_type" echo "Building and testing $project_name with .NET ${{ matrix.dotnet-version }}" dotnet build $csproj_path --framework ${{ matrix.framework }} --configuration Release /p:GITHUB_ACTIONS=false From 9806df9d45ad079287b1920e4f409c3463828c6f Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 14 Jan 2025 20:04:08 -0600 Subject: [PATCH 30/30] Removed small file from project since it couldn't be found by the E2E test harness, creating as part of operation now Signed-off-by: Whit Waldo --- .../Client/Cryptography/Cryptography.csproj | 6 --- .../EncryptDecryptFileStreamExample.cs | 47 +++++++++++++++++-- examples/Client/Cryptography/Program.cs | 2 + examples/Client/Cryptography/smallfile.txt | 26 ---------- 4 files changed, 44 insertions(+), 37 deletions(-) delete mode 100644 examples/Client/Cryptography/smallfile.txt diff --git a/examples/Client/Cryptography/Cryptography.csproj b/examples/Client/Cryptography/Cryptography.csproj index f63da1e1f..58ec42b68 100644 --- a/examples/Client/Cryptography/Cryptography.csproj +++ b/examples/Client/Cryptography/Cryptography.csproj @@ -16,10 +16,4 @@ - - - PreserveNewest - - - \ No newline at end of file diff --git a/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs b/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs index f3c8f1073..bab214150 100644 --- a/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs +++ b/examples/Client/Cryptography/Examples/EncryptDecryptFileStreamExample.cs @@ -24,17 +24,17 @@ public override async Task RunAsync(CancellationToken cancellationToken) { using var client = new DaprClientBuilder().Build(); - // The name of the file we're using as an example - const string fileName = "./smallfile.txt"; + //Create the small data file + var tempSmallFile = await CreateSmallFileAsync(); Console.WriteLine("Original file contents:"); - foreach (var line in await File.ReadAllLinesAsync(fileName, cancellationToken)) + foreach (var line in await File.ReadAllLinesAsync(tempSmallFile, cancellationToken)) { Console.WriteLine(line); } //Encrypt from a file stream and buffer the resulting bytes to an in-memory buffer - await using var encryptFs = new FileStream(fileName, FileMode.Open); + await using var encryptFs = new FileStream(tempSmallFile, FileMode.Open); var bufferedEncryptedBytes = new ArrayBufferWriter(); await foreach (var bytes in (await client.EncryptAsync(componentName, encryptFs, keyName, @@ -66,8 +66,45 @@ public override async Task RunAsync(CancellationToken cancellationToken) Console.WriteLine("Decrypted value: "); Console.WriteLine(decryptedValue); - //And some cleanup to delete our temp file + //And some cleanup to delete our temp files + File.Delete(tempSmallFile); File.Delete(tempDecryptedFile); } + + private static async Task CreateSmallFileAsync() + { + const string fileData = """ + # The Road Not Taken + ## By Robert Lee Frost + + Two roads diverged in a yellow wood, + And sorry I could not travel both + And be one traveler, long I stood + And looked down one as far as I could + To where it bent in the undergrowth; + + Then took the other, as just as fair + And having perhaps the better claim, + Because it was grassy and wanted wear; + Though as for that, the passing there + Had worn them really about the same, + + And both that morning equally lay + In leaves no step had trodden black + Oh, I kept the first for another day! + Yet knowing how way leads on to way, + I doubted if I should ever come back. + + I shall be telling this with a sigh + Somewhere ages and ages hence: + Two roads diverged in a wood, and I, + I took the one less traveled by, + And that has made all the difference. + """; + + var tempFileName = Path.GetTempFileName(); + await File.WriteAllTextAsync(tempFileName, fileData); + return tempFileName; + } } } diff --git a/examples/Client/Cryptography/Program.cs b/examples/Client/Cryptography/Program.cs index 5c63d7361..763ffc68a 100644 --- a/examples/Client/Cryptography/Program.cs +++ b/examples/Client/Cryptography/Program.cs @@ -45,5 +45,7 @@ static async Task Main(string[] args) Console.WriteLine(); return 1; } + + } } diff --git a/examples/Client/Cryptography/smallfile.txt b/examples/Client/Cryptography/smallfile.txt deleted file mode 100644 index 9e8638939..000000000 --- a/examples/Client/Cryptography/smallfile.txt +++ /dev/null @@ -1,26 +0,0 @@ -# The Road Not Taken -## By Robert Lee Frost - -Two roads diverged in a yellow wood, -And sorry I could not travel both -And be one traveler, long I stood -And looked down one as far as I could -To where it bent in the undergrowth; - -Then took the other, as just as fair -And having perhaps the better claim, -Because it was grassy and wanted wear; -Though as for that, the passing there -Had worn them really about the same, - -And both that morning equally lay -In leaves no step had trodden black -Oh, I kept the first for another day! -Yet knowing how way leads on to way, -I doubted if I should ever come back. - -I shall be telling this with a sigh -Somewhere ages and ages hence: -Two roads diverged in a wood, and I, -I took the one less traveled by, -And that has made all the difference. \ No newline at end of file