Skip to content

Commit

Permalink
Version Skew Integration Tests
Browse files Browse the repository at this point in the history
Like the existing e2e version skew tests, this PR adds version skew
integration tests. It runs the latest release integrations tests on a
matrix of latest release/master and control plane/daprd. There is also a
patching mechanism to account for things like accepted breaking changes
and error string matching.

Like master, the current placement/actor tests are currently failing.

Invoked via `/test-version-skew`.

Signed-off-by: joshvanl <me@joshvanl.dev>
  • Loading branch information
JoshVanL committed Dec 14, 2023
1 parent a450f61 commit 2275262
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/tests/integration/suite/daprd/serviceinvocation/http/httpendpoints.go b/tests/integration/suite/daprd/serviceinvocation/http/httpendpoints.go
index 1bb56944f..18bb9c63a 100644
--- a/tests/integration/suite/daprd/serviceinvocation/http/httpendpoints.go
+++ b/tests/integration/suite/daprd/serviceinvocation/http/httpendpoints.go
@@ -209,7 +209,7 @@ func (h *httpendpoints) Run(t *testing.T, ctx context.Context) {
t.Run("bad PKI", func(t *testing.T) {
invokeTests(t, http.StatusInternalServerError, func(t *testing.T, body string) {
assert.Contains(t, body, `"errorCode":"ERR_DIRECT_INVOKE"`)
- assert.Contains(t, body, "tls: bad certificate")
+ assert.Contains(t, body, "remote error: tls: unknown certificate authority")
}, h.daprd2)
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/tests/integration/suite/daprd/metadata/metadata.go b/tests/integration/suite/daprd/metadata/metadata.go
index 5e5a86452..0cccd8bd8 100644
--- a/tests/integration/suite/daprd/metadata/metadata.go
+++ b/tests/integration/suite/daprd/metadata/metadata.go
@@ -19,6 +19,7 @@ import (
"fmt"
"io"
"net/http"
+ "strings"
"testing"
"time"

@@ -82,11 +83,13 @@ func validateResponse(t *testing.T, appID string, appPort int, body io.Reader) {
require.NoError(t, err)

require.Equal(t, appID, bodyMap["id"])
- require.Equal(t, "edge", bodyMap["runtimeVersion"])
+ require.True(t, "edge" == bodyMap["runtimeVersion"].(string) ||
+ strings.HasPrefix(bodyMap["runtimeVersion"].(string), "1.12."))

extended, ok := bodyMap["extended"].(map[string]interface{})
require.True(t, ok)
- require.Equal(t, "edge", extended["daprRuntimeVersion"])
+ require.True(t, "edge" == extended["daprRuntimeVersion"].(string) ||
+ strings.HasPrefix(extended["daprRuntimeVersion"].(string), "1.12."))

appConnectionProperties, ok := bodyMap["appConnectionProperties"].(map[string]interface{})
require.True(t, ok)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# limitations under the License.
#

name: Version Skew E2E tests on KinD
name: Version Skew tests on KinD

on:
# Run when a PR is merged to master.
Expand All @@ -38,8 +38,173 @@ jobs:
# skew of N-1 and still be fully functional. This workflow verifies this
# guarantee holds for master and the previous release (or overridden version
# reference).
#
# The workflow runs our e2e tests on KinD. Tests are performed with the

# This workflow runs the previous releases integration tests against the
# matrix of master/latest-release daprd/control-plane. This ensures the
# previous assertions hold for the current HEAD, and version skew works
# between daprd and the control plane.
integration-version-skew:
name: integration-version-skew
runs-on: ubuntu-latest
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
mode:
- control-plane-master
- dapr-sidecar-master
steps:
- name: Set up for Dapr lastest release
run: |
echo "DAPR_PREV_VERSION=$(curl -s https://api.github.com/repos/dapr/dapr/releases/latest | jq -r '.tag_name' | cut -c 2-)" >> $GITHUB_ENV
- name: Set up for master
if: github.event_name != 'repository_dispatch'
run: |
echo "CHECKOUT_REPO=${{ github.repository }}" >> $GITHUB_ENV
echo "CHECKOUT_REF=refs/heads/master" >> $GITHUB_ENV
shell: bash
- name: Setup test output
shell: bash
run: |
export TEST_OUTPUT_FILE_PREFIX=$GITHUB_WORKSPACE/test_report
echo "TEST_OUTPUT_FILE_PREFIX=$TEST_OUTPUT_FILE_PREFIX" >> $GITHUB_ENV
- name: Parse test payload
if: github.event_name == 'repository_dispatch'
uses: actions/github-script@v6.2.0
with:
github-token: ${{secrets.DAPR_BOT_TOKEN}}
script: |
const testPayload = context.payload.client_payload;
if (testPayload) {
var fs = require('fs');
var envs = `CHECKOUT_REPO=${testPayload.pull_head_repo}\n`+
`CHECKOUT_REF=${testPayload.pull_head_ref}\n`+
`PR_NUMBER=${testPayload.issue.number}`;
if (testPayload.previous_version) {
envs += `\nDAPR_PREV_VERSION=${testPayload.previous_version}`;
}
// Set environment variables
fs.appendFileSync(process.env.GITHUB_ENV, envs);
}
- name: Create PR comment
if: env.PR_NUMBER != ''
uses: artursouza/sticky-pull-request-comment@v2.2.0
with:
header: ${{ github.run_id }}-version-skew-integration-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
hide: true
hide_classify: OUTDATED
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
# Dapr Version Skew integration test (${{ matrix.mode }} - ${{ env.DAPR_PREV_VERSION }})
🔗 **[Link to Action run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})**
Commit ref: ${{ env.CHECKOUT_REF }}
- name: Check out code
uses: actions/checkout@v3
with:
repository: ${{ env.CHECKOUT_REPO }}
ref: ${{ env.CHECKOUT_REF }}
- name: Checkout last release repo
uses: actions/checkout@v3
with:
repository: dapr/dapr
path: latest-release
ref: v${{ env.DAPR_PREV_VERSION }}
- name: Apply patches to latest release
run: |
export DAPR_LATEST_MAJOR_MINOR=$(echo ${{ env.DAPR_PREV_VERSION }} | cut -d. -f1-2)
export DAPR_PATCH_DIR="$(pwd)/.github/scripts/version-skew-test-patches/integration/release-$DAPR_LATEST_MAJOR_MINOR"
if [ -d "$DAPR_PATCH_DIR" ]; then
cd latest-release
echo "Applying patches from $DAPR_PATCH_DIR to $(pwd)"
git apply --ignore-space-change --ignore-whitespace $DAPR_PATCH_DIR/*.patch
git diff
fi
- name: Set up Go
id: setup-go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- name: Build & download binaries
run: |
make build
mkdir -p downloads && cd downloads
curl -so daprd_linux_amd64.tar.gz -L https://github.com/dapr/dapr/releases/download/v${{ env.DAPR_PREV_VERSION }}/daprd_linux_amd64.tar.gz
curl -so sentry_linux_amd64.tar.gz -L https://github.com/dapr/dapr/releases/download/v${{ env.DAPR_PREV_VERSION }}/sentry_linux_amd64.tar.gz
curl -so placement_linux_amd64.tar.gz -L https://github.com/dapr/dapr/releases/download/v${{ env.DAPR_PREV_VERSION }}/placement_linux_amd64.tar.gz
curl -so injector_linux_amd64.tar.gz -L https://github.com/dapr/dapr/releases/download/v${{ env.DAPR_PREV_VERSION }}/injector_linux_amd64.tar.gz
curl -so operator_linux_amd64.tar.gz -L https://github.com/dapr/dapr/releases/download/v${{ env.DAPR_PREV_VERSION }}/operator_linux_amd64.tar.gz
tar xvf daprd_linux_amd64.tar.gz
tar xvf sentry_linux_amd64.tar.gz
tar xvf placement_linux_amd64.tar.gz
tar xvf injector_linux_amd64.tar.gz
tar xvf operator_linux_amd64.tar.gz
- name: Setup DAPR_INTEGRATION_X_PATH - control-plane master
if: matrix.mode == 'control-plane-master'
run: |
echo "DAPR_INTEGRATION_DAPRD_PATH=$(pwd)/downloads/daprd" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_PLACEMENT_PATH=$(pwd)/dist/linux_amd64/release/placement" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_OPERATOR_PATH=$(pwd)/dist/linux_amd64/release/operator" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_SENTRY_PATH=$(pwd)/dist/linux_amd64/release/sentry" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_INJECTOR_PATH=$(pwd)/dist/linux_amd64/release/injector" >> $GITHUB_ENV
- name: Setup DAPR_INTEGRATION_X_PATH - dapr-sidecar master
if: matrix.mode == 'dapr-sidecar-master'
run: |
echo "DAPR_INTEGRATION_DAPRD_PATH=$(pwd)/dist/linux_amd64/release/daprd" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_PLACEMENT_PATH=$(pwd)/downloads/placement" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_SENTRY_PATH=$(pwd)/downloads/sentry" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_OPERATOR_PATH=$(pwd)/downloads/operator" >> $GITHUB_ENV
echo "DAPR_INTEGRATION_INJECTOR_PATH=$(pwd)/downloads/injector" >> $GITHUB_ENV
- name: Run make test-integration
run: cd latest-release && make test-integration

- name: Upload test results
if: always()
uses: actions/upload-artifact@master
with:
name: latest-release/${{ matrix.mode }}_test_e2e.json
path: latest-release/${{ env.TEST_OUTPUT_FILE_PREFIX }}_integration.*
- name: Update PR comment for success
if: ${{ success() }}
uses: artursouza/sticky-pull-request-comment@v2.2.0
with:
header: ${{ github.run_id }}-version-skew-integration-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
## ✅ Version Skew tests passed
- name: Update PR comment for failure
if: ${{ failure() }}
uses: artursouza/sticky-pull-request-comment@v2.2.0
with:
header: ${{ github.run_id }}-version-skew-integration-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
## ❌ Version Skew tests failed
Please check the logs for details on the error.
- name: Update PR comment for cancellation
if: ${{ cancelled() }}
uses: artursouza/sticky-pull-request-comment@v2.2.0
with:
header: ${{ github.run_id }}-version-skew-integration-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
## ⚠️ Version Skew tests cancelled
The Action has been canceled
# This workflow runs our e2e tests on KinD. Tests are performed with the
# control plane on master and side car on the previous release, and vice
# versa.
#
Expand Down Expand Up @@ -93,13 +258,13 @@ jobs:
if: env.PR_NUMBER != ''
uses: artursouza/sticky-pull-request-comment@v2.2.0
with:
header: ${{ github.run_id }}-version-skew-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
header: ${{ github.run_id }}-version-skew-e2e-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
hide: true
hide_classify: OUTDATED
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
message: |
# Dapr Version Skew test (${{ matrix.mode }} - ${{ env.DAPR_PREV_VERSION }})
# Dapr Version Skew e2e test (${{ matrix.mode }} - ${{ env.DAPR_PREV_VERSION }})
🔗 **[Link to Action run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})**
Expand All @@ -118,10 +283,13 @@ jobs:
- name: Apply patches to latest release
run: |
export DAPR_LATEST_MAJOR_MINOR=$(echo ${{ env.DAPR_PREV_VERSION }} | cut -d. -f1-2)
export DAPR_PATCH_DIR="$(pwd)/.github/scripts/version-skew-test-patches/release-$DAPR_LATEST_MAJOR_MINOR"
export DAPR_PATCH_DIR="$(pwd)/.github/scripts/version-skew-test-patches/e2e/release-$DAPR_LATEST_MAJOR_MINOR"
if [ -d "$DAPR_PATCH_DIR" ]; then
echo "Applying patches from $DAPR_PATCH_DIR"
cd latest-release && git apply --ignore-space-change --ignore-whitespace $DAPR_PATCH_DIR/*.patch
cd latest-release
echo "Applying patches from $DAPR_PATCH_DIR to $(pwd)"
git apply --ignore-space-change --ignore-whitespace $DAPR_PATCH_DIR/*.patch
git diff
fi
- name: Set up Go
id: setup-go
Expand Down Expand Up @@ -276,7 +444,7 @@ jobs:
if: ${{ success() }}
uses: artursouza/sticky-pull-request-comment@v2.2.0
with:
header: ${{ github.run_id }}-version-skew-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
header: ${{ github.run_id }}-version-skew-e2e-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
Expand All @@ -286,7 +454,7 @@ jobs:
if: ${{ failure() }}
uses: artursouza/sticky-pull-request-comment@v2.2.0
with:
header: ${{ github.run_id }}-version-skew-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
header: ${{ github.run_id }}-version-skew-e2e-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
Expand All @@ -298,7 +466,7 @@ jobs:
if: ${{ cancelled() }}
uses: artursouza/sticky-pull-request-comment@v2.2.0
with:
header: ${{ github.run_id }}-version-skew-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
header: ${{ github.run_id }}-version-skew-e2e-${{ matrix.mode }}-${{ env.DAPR_PREV_VERSION }}
number: ${{ env.PR_NUMBER }}
append: true
GITHUB_TOKEN: ${{ secrets.DAPR_BOT_TOKEN }}
Expand Down

0 comments on commit 2275262

Please sign in to comment.