refactor(util): move panel version comparison into a shared package

The node-assignment path in the service package needs the same
MAJOR.MINOR.PATCH comparison the panel updater uses, but service/panel
imports service, so the helper cannot stay there.
This commit is contained in:
MHSanaei
2026-10-02 23:56:52 +02:00
parent 05a083eaef
commit 97bee832f4
4 changed files with 62 additions and 48 deletions
+12
View File
@@ -0,0 +1,12 @@
package version
import "testing"
func TestCompareRejectsUnexpectedFormats(t *testing.T) {
if _, ok := Compare("latest", "2.9.3"); ok {
t.Fatal("expected non-semver latest tag to be rejected")
}
if _, ok := Compare("v2.9", "2.9.3"); ok {
t.Fatal("expected short version to be rejected")
}
}