MCPcopy Create free account
hub / github.com/tailscale/tailscale / TestCheckOutdatedAlpineRepo

Function TestCheckOutdatedAlpineRepo

clientupdate/clientupdate_test.go:305–424  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

303}
304
305func TestCheckOutdatedAlpineRepo(t *testing.T) {
306 anyToString := func(a any) string {
307 str, ok := a.(string)
308 if !ok {
309 panic("failed to parse param as string")
310 }
311 return str
312 }
313
314 tests := []struct {
315 name string
316 fileContent string
317 latestHTTPVersion string
318 latestApkVersion string
319 wantHTTPVersion string
320 wantApkVersion string
321 wantAlpineVersion string
322 track string
323 }{
324 {
325 name: "up-to-date",
326 fileContent: "https://dl-cdn.alpinelinux.org/alpine/v3.20/main",
327 latestHTTPVersion: "1.95.3",
328 latestApkVersion: "1.95.3",
329 track: "unstable",
330 },
331 {
332 name: "behind-unstable",
333 fileContent: "https://dl-cdn.alpinelinux.org/alpine/v3.20/main",
334 latestHTTPVersion: "1.95.4",
335 latestApkVersion: "1.95.3",
336 wantHTTPVersion: "1.95.4",
337 wantApkVersion: "1.95.3",
338 wantAlpineVersion: "v3.20",
339 track: "unstable",
340 },
341 {
342 name: "behind-stable",
343 fileContent: "https://dl-cdn.alpinelinux.org/alpine/v2.40/main",
344 latestHTTPVersion: "1.94.3",
345 latestApkVersion: "1.92.1",
346 wantHTTPVersion: "1.94.3",
347 wantApkVersion: "1.92.1",
348 wantAlpineVersion: "v2.40",
349 track: "stable",
350 },
351 {
352 name: "nothing-in-dist-file",
353 fileContent: "",
354 latestHTTPVersion: "1.94.3",
355 latestApkVersion: "1.92.1",
356 wantHTTPVersion: "1.94.3",
357 wantApkVersion: "1.92.1",
358 track: "stable",
359 },
360 }
361 for _, tt := range tests {
362 t.Run(tt.name, func(t *testing.T) {

Callers

nothing calls this directly

Calls 12

CloseMethod · 0.95
checkOutdatedAlpineRepoFunction · 0.85
RunMethod · 0.65
FatalfMethod · 0.65
CleanupMethod · 0.65
RemoveAllMethod · 0.65
WriteFileMethod · 0.65
MarshalMethod · 0.65
ErrorfMethod · 0.65
SetMethod · 0.65
WriteMethod · 0.65
HeaderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…