Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests running master in CI with specific dapr version #1461

Merged
merged 7 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tests/e2e/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const (
devZipkinReleaseName = "dapr-dev-zipkin"
)

var VersionWithScheduler = semver.MustParse("1.14.0")
var VersionWithScheduler = semver.MustParse("1.14.0-rc.1")

type VersionDetails struct {
RuntimeVersion string
Expand Down Expand Up @@ -109,6 +109,13 @@ func GetVersionsFromEnv(t *testing.T, latest bool) (string, string) {
return daprRuntimeVersion, daprDashboardVersion
}

func GetRuntimeVersion(t *testing.T, latest bool) *semver.Version {
daprRuntimeVersion, _ := GetVersionsFromEnv(t, latest)
runtimeVersion, err := semver.NewVersion(daprRuntimeVersion)
require.NoError(t, err)
return runtimeVersion
}

func UpgradeTest(details VersionDetails, opts TestOptions) func(t *testing.T) {
return func(t *testing.T) {
daprPath := GetDaprPath()
Expand Down
17 changes: 13 additions & 4 deletions tests/e2e/standalone/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"runtime"
"testing"

"github.com/dapr/cli/tests/e2e/common"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand All @@ -35,9 +37,12 @@ func TestStandaloneRun(t *testing.T) {
output, err := cmdProcess(ctx, "placement", t.Log, "--metrics-port", "9091", "--healthz-port", "8081")
require.NoError(t, err)
t.Log(output)
output, err = cmdProcess(ctx, "scheduler", t.Log, "--metrics-port", "9092", "--healthz-port", "8082")
require.NoError(t, err)
t.Log(output)

if common.GetRuntimeVersion(t, false).GreaterThan(common.VersionWithScheduler) {
output, err = cmdProcess(ctx, "scheduler", t.Log, "--metrics-port", "9092", "--healthz-port", "8082")
require.NoError(t, err)
t.Log(output)
}
}
t.Cleanup(func() {
// remove dapr installation after all tests in this function.
Expand Down Expand Up @@ -68,7 +73,11 @@ func TestStandaloneRun(t *testing.T) {
output, err := cmdRun(path, "--dapr-internal-grpc-port", "9999", "--", "bash", "-c", "echo test")
t.Log(output)
require.NoError(t, err, "run failed")
assert.Contains(t, output, "Internal gRPC server is running on :9999")
if common.GetRuntimeVersion(t, false).GreaterThan(common.VersionWithScheduler) {
assert.Contains(t, output, "Internal gRPC server is running on :9999")
} else {
assert.Contains(t, output, "Internal gRPC server is running on port 9999")
}
assert.Contains(t, output, "Exited App successfully")
assert.Contains(t, output, "Exited Dapr successfully")
assert.NotContains(t, output, "Could not update sidecar metadata for cliPID")
Expand Down
Loading