Skip to content

Commit 6d5e64d

Browse files
authored
Fix tests running master in CI with specific dapr version (#1461)
* Fix tests running master in CI with specific dapr version Signed-off-by: Anton Troshin <[email protected]> * move env version load into common Signed-off-by: Anton Troshin <[email protected]> * fix k8s test files Signed-off-by: Anton Troshin <[email protected]> * Revert "fix k8s test files" This reverts commit 344867d. Signed-off-by: Anton Troshin <[email protected]> * Revert "move env version load into common" This reverts commit 39e8c8c. Signed-off-by: Anton Troshin <[email protected]> * Revert "Fix tests running master in CI with specific dapr version" This reverts commit a02c81f. Signed-off-by: Anton Troshin <[email protected]> * Add GetRuntimeVersion to be able to compare semver dapr versions for conditional tests Use GetRuntimeVersion in test Signed-off-by: Anton Troshin <[email protected]> --------- Signed-off-by: Anton Troshin <[email protected]>
1 parent 8cd81b0 commit 6d5e64d

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

tests/e2e/common/common.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const (
5757
devZipkinReleaseName = "dapr-dev-zipkin"
5858
)
5959

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

6262
type VersionDetails struct {
6363
RuntimeVersion string
@@ -109,6 +109,13 @@ func GetVersionsFromEnv(t *testing.T, latest bool) (string, string) {
109109
return daprRuntimeVersion, daprDashboardVersion
110110
}
111111

112+
func GetRuntimeVersion(t *testing.T, latest bool) *semver.Version {
113+
daprRuntimeVersion, _ := GetVersionsFromEnv(t, latest)
114+
runtimeVersion, err := semver.NewVersion(daprRuntimeVersion)
115+
require.NoError(t, err)
116+
return runtimeVersion
117+
}
118+
112119
func UpgradeTest(details VersionDetails, opts TestOptions) func(t *testing.T) {
113120
return func(t *testing.T) {
114121
daprPath := GetDaprPath()

tests/e2e/standalone/run_test.go

+13-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
"runtime"
2222
"testing"
2323

24+
"github.com/dapr/cli/tests/e2e/common"
25+
2426
"github.com/stretchr/testify/assert"
2527
"github.com/stretchr/testify/require"
2628
)
@@ -35,9 +37,12 @@ func TestStandaloneRun(t *testing.T) {
3537
output, err := cmdProcess(ctx, "placement", t.Log, "--metrics-port", "9091", "--healthz-port", "8081")
3638
require.NoError(t, err)
3739
t.Log(output)
38-
output, err = cmdProcess(ctx, "scheduler", t.Log, "--metrics-port", "9092", "--healthz-port", "8082")
39-
require.NoError(t, err)
40-
t.Log(output)
40+
41+
if common.GetRuntimeVersion(t, false).GreaterThan(common.VersionWithScheduler) {
42+
output, err = cmdProcess(ctx, "scheduler", t.Log, "--metrics-port", "9092", "--healthz-port", "8082")
43+
require.NoError(t, err)
44+
t.Log(output)
45+
}
4146
}
4247
t.Cleanup(func() {
4348
// remove dapr installation after all tests in this function.
@@ -68,7 +73,11 @@ func TestStandaloneRun(t *testing.T) {
6873
output, err := cmdRun(path, "--dapr-internal-grpc-port", "9999", "--", "bash", "-c", "echo test")
6974
t.Log(output)
7075
require.NoError(t, err, "run failed")
71-
assert.Contains(t, output, "Internal gRPC server is running on :9999")
76+
if common.GetRuntimeVersion(t, false).GreaterThan(common.VersionWithScheduler) {
77+
assert.Contains(t, output, "Internal gRPC server is running on :9999")
78+
} else {
79+
assert.Contains(t, output, "Internal gRPC server is running on port 9999")
80+
}
7281
assert.Contains(t, output, "Exited App successfully")
7382
assert.Contains(t, output, "Exited Dapr successfully")
7483
assert.NotContains(t, output, "Could not update sidecar metadata for cliPID")

0 commit comments

Comments
 (0)