mirror of https://github.com/dapr/cli.git
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 <anton@diagrid.io> * move env version load into common Signed-off-by: Anton Troshin <anton@diagrid.io> * fix k8s test files Signed-off-by: Anton Troshin <anton@diagrid.io> * Revert "fix k8s test files" This reverts commit 344867d19ca4b38e5a83a82a2a00bb04c1775bab. Signed-off-by: Anton Troshin <anton@diagrid.io> * Revert "move env version load into common" This reverts commit 39e8c8caf54a157464bb44dffe448fc75727487f. Signed-off-by: Anton Troshin <anton@diagrid.io> * Revert "Fix tests running master in CI with specific dapr version" This reverts commit a02c81f7e25a6bbdb8e3b172a8e215dae60d321f. Signed-off-by: Anton Troshin <anton@diagrid.io> * Add GetRuntimeVersion to be able to compare semver dapr versions for conditional tests Use GetRuntimeVersion in test Signed-off-by: Anton Troshin <anton@diagrid.io> --------- Signed-off-by: Anton Troshin <anton@diagrid.io>
This commit is contained in:
parent
8cd81b0477
commit
6d5e64d964
|
@ -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
|
||||
|
@ -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()
|
||||
|
|
|
@ -21,6 +21,8 @@ import (
|
|||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/dapr/cli/tests/e2e/common"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -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.
|
||||
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue