fix(core-agent): classify prerelease versions correctly
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
452c4a27c7
commit
fdbf7f7e4d
2 changed files with 6 additions and 4 deletions
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
package main
|
||||
|
||||
import agentpkg "dappco.re/go/agent"
|
||||
import (
|
||||
agentpkg "dappco.re/go/agent"
|
||||
core "dappco.re/go/core"
|
||||
)
|
||||
|
||||
// agentpkg.Version = "0.15.0"
|
||||
// updateChannel() // "stable"
|
||||
|
|
@ -10,7 +13,7 @@ func updateChannel() string {
|
|||
switch {
|
||||
case agentpkg.Version == "" || agentpkg.Version == "dev":
|
||||
return "dev"
|
||||
case agentpkg.Version != "" && (agentpkg.Version[len(agentpkg.Version)-1] >= 'a'):
|
||||
case core.Contains(agentpkg.Version, "-"):
|
||||
return "prerelease"
|
||||
default:
|
||||
return "stable"
|
||||
|
|
|
|||
|
|
@ -43,8 +43,7 @@ func TestUpdate_UpdateChannelNumericSuffix_Ugly(t *testing.T) {
|
|||
t.Cleanup(func() {
|
||||
agentpkg.Version = ""
|
||||
})
|
||||
// Ends in '1' which is < 'a', so stable
|
||||
assert.Equal(t, "stable", updateChannel())
|
||||
assert.Equal(t, "prerelease", updateChannel())
|
||||
}
|
||||
|
||||
func TestUpdate_ApplicationVersion_Good(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue