MCPcopy Create free account
hub / github.com/github/gh-aw / TestRunCompileUpdateCheck

Function TestRunCompileUpdateCheck

pkg/cli/compile_update_check_test.go:68–143  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func TestRunCompileUpdateCheck(t *testing.T) {
69 originalVersion := GetVersion()
70 originalRelease := workflow.IsRelease()
71 originalLatestURL := compileUpdateCheckLatestReleaseURL
72 originalProbeURLFunc := compileUpdateCheckProbeURLFunc
73 defer func() {
74 SetVersionInfo(originalVersion)
75 workflow.SetIsRelease(originalRelease)
76 compileUpdateCheckLatestReleaseURL = originalLatestURL
77 compileUpdateCheckProbeURLFunc = originalProbeURLFunc
78 }()
79
80 tests := []struct {
81 name string
82 currentVersion string
83 latestVersion string
84 existingTags map[string]bool
85 expected *compileUpdateNotification
86 }{
87 {
88 name: "returns minor version upgrade hint",
89 currentVersion: "v1.2.3",
90 latestVersion: "v1.3.0",
91 existingTags: map[string]bool{
92 "v1.2.3": true,
93 "v1.3.0": true,
94 },
95 expected: &compileUpdateNotification{
96 Kind: compileUpdateNotificationMinorBehind,
97 CurrentVersion: "v1.2.3",
98 LatestVersion: "v1.3.0",
99 },
100 },
101 {
102 name: "returns prominent notice when current tag is missing",
103 currentVersion: "v1.2.3",
104 latestVersion: "v1.3.0",
105 existingTags: map[string]bool{
106 "v1.3.0": true,
107 },
108 expected: &compileUpdateNotification{
109 Kind: compileUpdateNotificationRemovedTag,
110 CurrentVersion: "v1.2.3",
111 LatestVersion: "v1.3.0",
112 },
113 },
114 {
115 name: "ignores patch-only difference",
116 currentVersion: "v1.2.3",
117 latestVersion: "v1.2.4",
118 existingTags: map[string]bool{
119 "v1.2.3": true,
120 "v1.2.4": true,
121 },
122 expected: nil,
123 },
124 }
125

Callers

nothing calls this directly

Calls 9

IsReleaseFunction · 0.92
SetIsReleaseFunction · 0.92
SetVersionInfoFunction · 0.85
runCompileUpdateCheckFunction · 0.85
BackgroundMethod · 0.80
GetVersionFunction · 0.70
CloseMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected