Skip to content

Commit

Permalink
Fix check for version to contain scheduler. (#1417)
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
  • Loading branch information
artursouza authored Jul 6, 2024
1 parent fd1d8e8 commit 762e2bb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/standalone/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ func isSchedulerIncluded(runtimeVersion string) (bool, error) {
return false, err
}

return c.Check(v), nil
vNoPrerelease, err := v.SetPrerelease("")
if err != nil {
return false, err
}
return c.Check(&vNoPrerelease), nil
}

// Init installs Dapr on a local machine using the supplied runtimeVersion.
Expand Down
22 changes: 22 additions & 0 deletions pkg/standalone/standalone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,25 @@ func TestInitLogActualContainerRuntimeName(t *testing.T) {
})
}
}

func TestIsSchedulerIncluded(t *testing.T) {
scenarios := []struct {
version string
isIncluded bool
}{
{"1.13.0-rc.1", false},
{"1.13.0", false},
{"1.13.1", false},
{"1.14.0", true},
{"1.14.0-rc.1", true},
{"1.14.0-mycompany.1", true},
{"1.14.1", true},
}
for _, scenario := range scenarios {
t.Run("isSchedulerIncludedIn"+scenario.version, func(t *testing.T) {
included, err := isSchedulerIncluded(scenario.version)
assert.NoError(t, err)
assert.Equal(t, scenario.isIncluded, included)
})
}
}

0 comments on commit 762e2bb

Please sign in to comment.