Skip to content

Commit

Permalink
E2e fix (#1215)
Browse files Browse the repository at this point in the history
* fix e2e tests

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

* pass dashboard version to dapr init

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

* disable dashboard test for k8s

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

* upload run file logs in artifacts

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

* Revert "upload run file logs in artifacts"

This reverts commit e8343df.

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

* trigger pr checks

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

---------

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>
  • Loading branch information
pravinpushkar authored Feb 10, 2023
1 parent e82850a commit 84ba3aa
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 65 deletions.
46 changes: 24 additions & 22 deletions .github/workflows/kind_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
GOVER: 1.19.3
DAPR_RUNTIME_PINNED_VERSION: 1.10.0-rc.4
DAPR_DASHBOARD_PINNED_VERSION: 0.11.0
DAPR_RUNTIME_LATEST_VERSION:
DAPR_DASHBOARD_LATEST_VERSION:
DAPR_RUNTIME_LATEST_STABLE_VERSION:
DAPR_DASHBOARD_LATEST_STABLE_VERSION:
DAPR_TGZ: dapr-1.10.0-rc.4.tgz
strategy:
fail-fast: false # Keep running if one leg fails.
Expand Down Expand Up @@ -131,38 +131,40 @@ jobs:
- name: Free up some diskspace
run: |
docker image prune -a -f
- name: Determine latest stable Dapr Runtime version
- name: Determine latest Dapr Runtime version including Pre-releases
if: github.base_ref == 'master'
run: |
export RUNTIME_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dapr/releases/latest | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
export RUNTIME_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dapr/releases | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
if [[ -z "$RUNTIME_VERSION" ]]; then
echo "Could not fetch the latest Dapr Runtime version. Using default version $DAPR_RUNTIME_PINNED_VERSION"
echo "DAPR_RUNTIME_LATEST_VERSION=$DAPR_RUNTIME_PINNED_VERSION" >> $GITHUB_ENV
echo "Could not fetch the latest Dapr Runtime version. Using pinned version $DAPR_RUNTIME_PINNED_VERSION"
else
echo "Found $RUNTIME_VERSION"
echo "DAPR_RUNTIME_LATEST_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
base_ref=${{ github.base_ref }}
echo "Branch $base_ref"
if [[ $base_ref = 'master' ]]; then
echo "DAPR_RUNTIME_PINNED_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
fi
echo "DAPR_RUNTIME_PINNED_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
fi
shell: bash
- name: Determine latest stable Dapr Dashboard version
- name: Determine latest Dapr Dashboard version including Pre-releases
if: github.base_ref == 'master'
run: |
export DASHBOARD_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dashboard/releases/latest | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
export DASHBOARD_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dashboard/releases | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
if [[ -z "$DASHBOARD_VERSION" ]]; then
echo "Could not fetch the latest Dapr Dashboard version. Using default version $DAPR_DASHBOARD_PINNED_VERSION"
echo "DAPR_DASHBOARD_LATEST_VERSION=$DAPR_DASHBOARD_PINNED_VERSION" >> $GITHUB_ENV
echo "Could not fetch the latest Dapr Dashboard version. Using pinned version $DAPR_DASHBOARD_PINNED_VERSION"
else
echo "Found $DASHBOARD_VERSION"
echo "DAPR_DASHBOARD_LATEST_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
base_ref=${{ github.base_ref }}
echo "Branch $base_ref"
if [[ $base_ref = 'master' ]]; then
echo "DAPR_DASHBOARD_PINNED_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
fi
echo "DAPR_DASHBOARD_PINNED_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
fi
shell: bash
- name: Determine latest stable Dapr Runtime version
run: |
export LATEST_STABLE_RUNTIME_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dapr/releases/latest | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
echo "Found $LATEST_STABLE_RUNTIME_VERSION"
echo "DAPR_RUNTIME_LATEST_STABLE_VERSION=$LATEST_STABLE_RUNTIME_VERSION" >> $GITHUB_ENV
shell: bash
- name: Determine latest stable Dapr Dashboard version
run: |
export LATEST_STABLE_DASHBOARD_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dashboard/releases/latest | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
echo "Found $LATEST_STABLE_DASHBOARD_VERSION"
echo "DAPR_DASHBOARD_LATEST_STABLE_VERSION=$LATEST_STABLE_DASHBOARD_VERSION" >> $GITHUB_ENV
shell: bash
- name: Run tests with GHCR
# runs every 6hrs
if: github.event.schedule == '0 */6 * * *'
Expand Down
46 changes: 24 additions & 22 deletions .github/workflows/self_hosted_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
ARCHIVE_OUTDIR: dist/archives
DAPR_RUNTIME_PINNED_VERSION: "1.10.0-rc.4"
DAPR_DASHBOARD_PINNED_VERSION: 0.11.0
DAPR_RUNTIME_LATEST_VERSION:
DAPR_DASHBOARD_LATEST_VERSION:
DAPR_RUNTIME_LATEST_STABLE_VERSION:
DAPR_DASHBOARD_LATEST_STABLE_VERSION:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
Expand Down Expand Up @@ -78,38 +78,40 @@ jobs:
podman machine init
podman machine start
echo "CONTAINER_RUNTIME=podman" >> $GITHUB_ENV
- name: Determine latest stable Dapr Runtime version
- name: Determine latest Dapr Runtime version including Pre-releases
if: github.base_ref == 'master'
run: |
export RUNTIME_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dapr/releases/latest | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
export RUNTIME_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dapr/releases | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
if [[ -z "$RUNTIME_VERSION" ]]; then
echo "Could not fetch the latest Dapr Runtime version. Using default version $DAPR_RUNTIME_PINNED_VERSION"
echo "DAPR_RUNTIME_LATEST_VERSION=$DAPR_RUNTIME_PINNED_VERSION" >> $GITHUB_ENV
echo "Could not fetch the latest Dapr Runtime version. Using pinned version $DAPR_RUNTIME_PINNED_VERSION"
else
echo "Found $RUNTIME_VERSION"
echo "DAPR_RUNTIME_LATEST_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
base_ref=${{ github.base_ref }}
echo "Branch $base_ref"
if [[ $base_ref = 'master' ]]; then
echo "DAPR_RUNTIME_PINNED_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
fi
echo "DAPR_RUNTIME_PINNED_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
fi
shell: bash
- name: Determine latest stable Dapr Dashboard version
- name: Determine latest Dapr Dashboard version including Pre-releases
if: github.base_ref == 'master'
run: |
export DASHBOARD_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dashboard/releases/latest | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
export DASHBOARD_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dashboard/releases | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
if [[ -z "$DASHBOARD_VERSION" ]]; then
echo "Could not fetch the latest Dapr Dashboard version. Using default version $DAPR_DASHBOARD_PINNED_VERSION"
echo "DAPR_DASHBOARD_LATEST_VERSION=$DAPR_DASHBOARD_PINNED_VERSION" >> $GITHUB_ENV
echo "Could not fetch the latest Dapr Dashboard version. Using pinned version $DAPR_DASHBOARD_PINNED_VERSION"
else
echo "Found $DASHBOARD_VERSION"
echo "DAPR_DASHBOARD_LATEST_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
base_ref=${{ github.base_ref }}
echo "Branch $base_ref"
if [[ $base_ref = 'master' ]]; then
echo "DAPR_DASHBOARD_PINNED_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
fi
echo "DAPR_DASHBOARD_PINNED_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
fi
shell: bash
- name: Determine latest stable Dapr Runtime version
run: |
export LATEST_STABLE_RUNTIME_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dapr/releases/latest | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
echo "Found $LATEST_STABLE_RUNTIME_VERSION"
echo "DAPR_RUNTIME_LATEST_STABLE_VERSION=$LATEST_STABLE_RUNTIME_VERSION" >> $GITHUB_ENV
shell: bash
- name: Determine latest stable Dapr Dashboard version
run: |
export LATEST_STABLE_DASHBOARD_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dashboard/releases/latest | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1)
echo "Found $LATEST_STABLE_DASHBOARD_VERSION"
echo "DAPR_DASHBOARD_LATEST_STABLE_VERSION=$LATEST_STABLE_DASHBOARD_VERSION" >> $GITHUB_ENV
shell: bash
- name: Set the test timeout - MacOS
if: matrix.os == 'macos-latest'
run: echo "E2E_SH_TEST_TIMEOUT=30m" >> $GITHUB_ENV
Expand Down
22 changes: 13 additions & 9 deletions tests/e2e/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ func GetVersionsFromEnv(t *testing.T, latest bool) (string, string) {
runtimeEnvVar := "DAPR_RUNTIME_PINNED_VERSION"
dashboardEnvVar := "DAPR_DASHBOARD_PINNED_VERSION"
if latest {
runtimeEnvVar = "DAPR_RUNTIME_LATEST_VERSION"
dashboardEnvVar = "DAPR_DASHBOARD_LATEST_VERSION"
runtimeEnvVar = "DAPR_RUNTIME_LATEST_STABLE_VERSION"
dashboardEnvVar = "DAPR_DASHBOARD_LATEST_STABLE_VERSION"
}
if runtimeVersion, ok := os.LookupEnv(runtimeEnvVar); ok {
daprRuntimeVersion = runtimeVersion
Expand Down Expand Up @@ -329,7 +329,10 @@ func StatusTestOnInstallUpgrade(details VersionDetails, opts TestOptions) func(t
require.Equal(t, "True", cols[2], "healthly field must be true")
require.Equal(t, "Running", cols[3], "pods must be Running")
require.Equal(t, toVerify[1], cols[4], "replicas must be equal")
require.Equal(t, toVerify[0], cols[5], "versions must match")
// TODO: Skip the dashboard version check for now until the helm chart is updated.
if cols[0] != "dapr-dashboard" {
require.Equal(t, toVerify[0], cols[5], "versions must match")
}
delete(notFound, cols[0])
}
}
Expand Down Expand Up @@ -708,6 +711,7 @@ func installTest(details VersionDetails, opts TestOptions) func(t *testing.T) {
"--log-as-json",
}
if !details.UseDaprLatestVersion {
// TODO: Pass dashboard-version also when charts are released.
args = append(args, "--runtime-version", details.RuntimeVersion)
}
if opts.HAEnabled {
Expand Down Expand Up @@ -864,9 +868,9 @@ func validatePodsOnInstallUpgrade(t *testing.T, details VersionDetails) {
require.NoError(t, err)

notFound := map[string]string{
"sentry": details.RuntimeVersion,
"sidecar": details.RuntimeVersion,
"dashboard": details.DashboardVersion,
"sentry": details.RuntimeVersion,
"sidecar": details.RuntimeVersion,
// "dashboard": details.DashboardVersion, TODO: enable when helm charts are updated.
"placement": details.RuntimeVersion,
"operator": details.RuntimeVersion,
}
Expand All @@ -879,9 +883,9 @@ func validatePodsOnInstallUpgrade(t *testing.T, details VersionDetails) {
}

prefixes := map[string]string{
"sentry": "dapr-sentry-",
"sidecar": "dapr-sidecar-injector-",
"dashboard": "dapr-dashboard-",
"sentry": "dapr-sentry-",
"sidecar": "dapr-sidecar-injector-",
// "dashboard": "dapr-dashboard-", TODO: enable when helm charts are updated.
"placement": "dapr-placement-server-",
"operator": "dapr-operator-",
}
Expand Down
34 changes: 23 additions & 11 deletions tests/e2e/standalone/init_run_custom_path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ func TestStandaloneInitRunUninstallNonDefaultDaprPath(t *testing.T) {
assert.NoError(t, err)
defer os.RemoveAll(daprPath) // clean up

daprRuntimeVersion, _ := common.GetVersionsFromEnv(t, false)
output, err := cmdInit("--runtime-version", daprRuntimeVersion, "--runtime-path", daprPath)
daprRuntimeVersion, daprDashboardVersion := common.GetVersionsFromEnv(t, false)
args := []string{
"--runtime-version", daprRuntimeVersion,
"--dashboard-version", daprDashboardVersion,
"--runtime-path", daprPath,
}
output, err := cmdInit(args...)
t.Log(output)
require.NoError(t, err, "init failed")
assert.Contains(t, output, "Success! Dapr is up and running.")
Expand All @@ -54,7 +59,7 @@ func TestStandaloneInitRunUninstallNonDefaultDaprPath(t *testing.T) {
assert.Contains(t, lines[1], "Runtime version")
assert.Contains(t, lines[1], daprRuntimeVersion)

args := []string{
args = []string{
"--runtime-path", daprPath,
"--app-id", "run_with_dapr_runtime_path_flag",
"--", "bash", "-c", "echo 'test'",
Expand Down Expand Up @@ -90,9 +95,12 @@ func TestStandaloneInitRunUninstallNonDefaultDaprPath(t *testing.T) {

t.Setenv("DAPR_RUNTIME_PATH", daprPath)

daprRuntimeVersion, _ := common.GetVersionsFromEnv(t, false)

output, err := cmdInit("--runtime-version", daprRuntimeVersion)
daprRuntimeVersion, daprDashboardVersion := common.GetVersionsFromEnv(t, false)
args := []string{
"--runtime-version", daprRuntimeVersion,
"--dashboard-version", daprDashboardVersion,
}
output, err := cmdInit(args...)
t.Log(output)
require.NoError(t, err, "init failed")
assert.Contains(t, output, "Success! Dapr is up and running.")
Expand All @@ -108,7 +116,7 @@ func TestStandaloneInitRunUninstallNonDefaultDaprPath(t *testing.T) {
assert.Contains(t, lines[1], "Runtime version")
assert.Contains(t, lines[1], daprRuntimeVersion)

args := []string{
args = []string{
"--app-id", "run_with_dapr_runtime_path_flag",
"--", "bash", "-c", "echo 'test'",
}
Expand Down Expand Up @@ -147,9 +155,13 @@ func TestStandaloneInitRunUninstallNonDefaultDaprPath(t *testing.T) {

t.Setenv("DAPR_RUNTIME_PATH", daprPathEnv)

daprRuntimeVersion, _ := common.GetVersionsFromEnv(t, false)

output, err := cmdInit("--runtime-version", daprRuntimeVersion, "--runtime-path", daprPathFlag)
daprRuntimeVersion, daprDashboardVersion := common.GetVersionsFromEnv(t, false)
args := []string{
"--runtime-version", daprRuntimeVersion,
"--dashboard-version", daprDashboardVersion,
"--runtime-path", daprPathFlag,
}
output, err := cmdInit(args...)
t.Log(output)
require.NoError(t, err, "init failed")
assert.Contains(t, output, "Success! Dapr is up and running.")
Expand All @@ -165,7 +177,7 @@ func TestStandaloneInitRunUninstallNonDefaultDaprPath(t *testing.T) {
assert.Contains(t, lines[1], "Runtime version")
assert.Contains(t, lines[1], daprRuntimeVersion)

args := []string{
args = []string{
"--runtime-path", daprPathFlag,
"--app-id", "run_with_dapr_runtime_path_flag",
"--", "bash", "-c", "echo 'test'",
Expand Down
5 changes: 5 additions & 0 deletions tests/e2e/standalone/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func TestStandaloneInit(t *testing.T) {
must(t, cmdUninstall, "failed to uninstall Dapr")
args := []string{
"--runtime-version", daprRuntimeVersion,
"--dashboard-version", daprDashboardVersion,
"--image-registry", "smplregistry.io/owner",
}
output, err := cmdInit(args...)
Expand All @@ -66,6 +67,7 @@ func TestStandaloneInit(t *testing.T) {
must(t, cmdUninstall, "failed to uninstall Dapr")
args := []string{
"--runtime-version", daprRuntimeVersion,
"--dashboard-version", daprDashboardVersion,
"--image-registry", "localhost:5000",
"--from-dir", "./local-dir",
}
Expand All @@ -79,6 +81,7 @@ func TestStandaloneInit(t *testing.T) {
must(t, cmdUninstall, "failed to uninstall Dapr")
args := []string{
"--runtime-version", daprRuntimeVersion,
"--dashboard-version", daprDashboardVersion,
"--container-runtime", "invalid",
}
output, err := cmdInit(args...)
Expand All @@ -92,6 +95,7 @@ func TestStandaloneInit(t *testing.T) {

args := []string{
"--runtime-version", daprRuntimeVersion,
"--dashboard-version", daprDashboardVersion,
}
output, err := cmdInit(args...)
t.Log(output)
Expand All @@ -115,6 +119,7 @@ func TestStandaloneInit(t *testing.T) {

args := []string{
"--runtime-version", daprRuntimeVersion,
"--dashboard-version", daprDashboardVersion,
"--image-variant", "mariner",
}
output, err := cmdInit(args...)
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/standalone/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) {
// ensureDaprInstallation ensures that Dapr is installed.
// If Dapr is not installed, a new installation is attempted.
func ensureDaprInstallation(t *testing.T) {
daprRuntimeVersion, _ := common.GetVersionsFromEnv(t, false)
daprRuntimeVersion, daprDashboardVersion := common.GetVersionsFromEnv(t, false)
homeDir, err := os.UserHomeDir()
require.NoError(t, err, "failed to get user home directory")

Expand All @@ -134,6 +134,7 @@ func ensureDaprInstallation(t *testing.T) {
if os.IsNotExist(err) {
args := []string{
"--runtime-version", daprRuntimeVersion,
"--dashboard-version", daprDashboardVersion,
}
output, err := cmdInit(args...)
require.NoError(t, err, "failed to install dapr:%v", output)
Expand Down

0 comments on commit 84ba3aa

Please sign in to comment.