mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-11 01:36:37 +08:00
feat: add support for release channels in version upgrade and node agent updates
- Introduced ReleaseChannel type to manage stable and preview releases. - Updated DashboardTopbar to handle version upgrades based on selected release channel. - Enhanced node detail page to allow manual checks for agent updates on stable and preview channels. - Modified API endpoints to support fetching and upgrading based on release channels. - Updated UI components to reflect changes in version checking and upgrade processes. - Added tests for new functionality related to preview releases and agent updates.
This commit is contained in:
@@ -38,6 +38,9 @@ func TestIsVersionNewer(t *testing.T) {
|
||||
{name: "same version", current: "v1.2.3", latest: "v1.2.3", expected: false},
|
||||
{name: "older remote", current: "v1.3.0", latest: "v1.2.9", expected: false},
|
||||
{name: "double digit segment", current: "v1.9.9", latest: "v1.10.0", expected: true},
|
||||
{name: "stable newer than prerelease", current: "v1.2.3-rc.1", latest: "v1.2.3", expected: true},
|
||||
{name: "prerelease not newer than same stable", current: "v1.2.3", latest: "v1.2.3-rc.1", expected: false},
|
||||
{name: "newer prerelease sequence", current: "v1.2.3-rc.1", latest: "v1.2.3-rc.2", expected: true},
|
||||
{name: "dev build", current: "dev", latest: "v0.4.0", expected: true},
|
||||
}
|
||||
|
||||
@@ -70,7 +73,7 @@ func TestBuildLatestServerReleaseView(t *testing.T) {
|
||||
Body: "release notes",
|
||||
HTMLURL: "https://github.com/Rain-kl/ATSFlare/releases/tag/v0.5.0",
|
||||
PublishedAt: "2026-03-11T00:00:00Z",
|
||||
})
|
||||
}, ReleaseChannelStable)
|
||||
|
||||
if view.CurrentVersion != "v0.4.0" {
|
||||
t.Fatalf("unexpected current version: %s", view.CurrentVersion)
|
||||
@@ -84,6 +87,9 @@ func TestBuildLatestServerReleaseView(t *testing.T) {
|
||||
if view.TagName != "v0.5.0" {
|
||||
t.Fatalf("unexpected tag name: %s", view.TagName)
|
||||
}
|
||||
if view.Channel != ReleaseChannelStable.String() {
|
||||
t.Fatalf("unexpected channel: %s", view.Channel)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildLatestServerReleaseViewDevBuild(t *testing.T) {
|
||||
@@ -98,7 +104,7 @@ func TestBuildLatestServerReleaseViewDevBuild(t *testing.T) {
|
||||
|
||||
view := buildLatestServerReleaseView(&githubReleaseResponse{
|
||||
TagName: "v0.5.0",
|
||||
})
|
||||
}, ReleaseChannelStable)
|
||||
|
||||
if view.HasUpdate {
|
||||
t.Fatal("expected dev build not to report update availability")
|
||||
@@ -108,6 +114,31 @@ func TestBuildLatestServerReleaseViewDevBuild(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildLatestServerReleaseViewPreview(t *testing.T) {
|
||||
originalVersion := common.Version
|
||||
common.Version = "v0.5.0-rc.1"
|
||||
t.Cleanup(func() {
|
||||
common.Version = originalVersion
|
||||
resetServerUpgradeTestState(t)
|
||||
})
|
||||
|
||||
view := buildLatestServerReleaseView(&githubReleaseResponse{
|
||||
TagName: "v0.5.0-rc.2",
|
||||
Prerelease: true,
|
||||
PublishedAt: "2026-03-12T00:00:00Z",
|
||||
}, ReleaseChannelPreview)
|
||||
|
||||
if !view.HasUpdate {
|
||||
t.Fatal("expected preview release to be newer")
|
||||
}
|
||||
if !view.Prerelease {
|
||||
t.Fatal("expected preview flag to be true")
|
||||
}
|
||||
if view.Channel != ReleaseChannelPreview.String() {
|
||||
t.Fatalf("unexpected channel: %s", view.Channel)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUploadManualServerBinary(t *testing.T) {
|
||||
originalVersion := common.Version
|
||||
common.Version = "v0.4.0"
|
||||
|
||||
Reference in New Issue
Block a user