Skip to content

Commit

Permalink
Merge branch 'master' into release/pin-gover
Browse files Browse the repository at this point in the history
  • Loading branch information
yaron2 authored Jan 20, 2025
2 parents 7372b7d + 3acfa7d commit a314521
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ func executeRun(runTemplateName, runFilePath string, apps []runfileconfig.App) (
exitWithError = true
break
}

runConfig.SchedulerHostAddress = validateSchedulerHostAddress(daprVer.RuntimeVersion, runConfig.SchedulerHostAddress)

// Combined multiwriter for logs.
var appDaprdWriter io.Writer
// appLogWriter is used when app command is present.
Expand Down Expand Up @@ -664,6 +667,17 @@ func executeRunWithAppsConfigFile(runFilePath string, k8sEnabled bool) {
}
}

// populate the scheduler host address based on the dapr version.
func validateSchedulerHostAddress(version, address string) string {
// If no SchedulerHostAddress is supplied, set it to default value.
if semver.Compare(fmt.Sprintf("v%v", version), "v1.15.0-rc.0") == 1 {
if address == "" {
return "localhost:50006"
}
}
return address
}

func getRunConfigFromRunFile(runFilePath string) (runfileconfig.RunFileConfig, []runfileconfig.App, error) {
config := runfileconfig.RunFileConfig{}
apps, err := config.GetApps(runFilePath)
Expand Down
19 changes: 19 additions & 0 deletions cmd/run_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestValidateSchedulerHostAddress(t *testing.T) {
t.Run("test scheduler host address - v1.14.0-rc.0", func(t *testing.T) {
address := validateSchedulerHostAddress("1.14.0-rc.0", "")
assert.Equal(t, "", address)
})

t.Run("test scheduler host address - v1.15.0-rc.0", func(t *testing.T) {
address := validateSchedulerHostAddress("1.15.0", "")
assert.Equal(t, "localhost:50006", address)
})
}

0 comments on commit a314521

Please sign in to comment.