mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-01 16:07:17 +00:00
fix(nodes): report dev builds as dev+<commit> so updated nodes aren't flagged stale
A node's status reported config.GetVersion() (3.4.0) even on a dev build, so the master compared it against its own dev latestVersion (dev+<sha>) and every node showed 'update available'. Nodes on a dev build now report dev+<short commit>, matching the master's format, so a node on the current dev commit compares as up to date.
This commit is contained in:
@@ -5,6 +5,26 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetReportedVersion(t *testing.T) {
|
||||
orig := buildCommit
|
||||
t.Cleanup(func() { buildCommit = orig })
|
||||
|
||||
buildCommit = ""
|
||||
if got := GetReportedVersion(); got != GetVersion() {
|
||||
t.Fatalf("stable build: GetReportedVersion = %q, want %q", got, GetVersion())
|
||||
}
|
||||
|
||||
buildCommit = "1d1128cf"
|
||||
if got := GetReportedVersion(); got != "dev+1d1128cf" {
|
||||
t.Fatalf("dev build: GetReportedVersion = %q, want %q", got, "dev+1d1128cf")
|
||||
}
|
||||
|
||||
buildCommit = "1d1128cf945c4615efa05cf41ba7fa766e2ee428"
|
||||
if got := GetReportedVersion(); got != "dev+1d1128cf" {
|
||||
t.Fatalf("dev build (full sha): GetReportedVersion = %q, want %q", got, "dev+1d1128cf")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetPortOverride(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user