Skip to content

Commit 372c672

Browse files
committed
Fix check for version to contain scheduler.
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
1 parent fd1d8e8 commit 372c672

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

pkg/standalone/standalone.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,11 @@ func isSchedulerIncluded(runtimeVersion string) (bool, error) {
176176
return false, err
177177
}
178178

179-
return c.Check(v), nil
179+
vNoPrerelease, err := v.SetPrerelease("")
180+
if err != nil {
181+
return false, err
182+
}
183+
return c.Check(&vNoPrerelease), nil
180184
}
181185

182186
// Init installs Dapr on a local machine using the supplied runtimeVersion.

pkg/standalone/standalone_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,3 +334,26 @@ func TestInitLogActualContainerRuntimeName(t *testing.T) {
334334
})
335335
}
336336
}
337+
338+
func TestIsSchedulerIncluded(t *testing.T) {
339+
scenarios := []struct {
340+
version string
341+
isIncluded bool
342+
}{
343+
{"1.13.0-rc.1", false},
344+
{"1.13.0", false},
345+
{"1.13.1", false},
346+
{"1.14.0", true},
347+
{"1.14.0-rc.1", true},
348+
{"1.14.0-mycompany.1", true},
349+
{"1.14.1", true},
350+
}
351+
for _, scenario := range scenarios {
352+
t.Run("isSchedulerIncludedIn"+scenario.version, func(t *testing.T) {
353+
included, err := isSchedulerIncluded(scenario.version)
354+
assert.NoError(t, err)
355+
assert.Equal(t, scenario.isIncluded, included)
356+
})
357+
}
358+
359+
}

0 commit comments

Comments
 (0)