MCPcopy
hub / github.com/Jguer/yay / TestIntegrationLocalInstallNeeded

Function TestIntegrationLocalInstallNeeded

local_install_test.go:453–608  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

451}
452
453func TestIntegrationLocalInstallNeeded(t *testing.T) {
454 makepkgBin := t.TempDir() + "/makepkg"
455 pacmanBin := t.TempDir() + "/pacman"
456 gitBin := t.TempDir() + "/git"
457 tmpDir := t.TempDir()
458 f, err := os.OpenFile(makepkgBin, os.O_RDONLY|os.O_CREATE, 0o755)
459 require.NoError(t, err)
460 require.NoError(t, f.Close())
461
462 f, err = os.OpenFile(pacmanBin, os.O_RDONLY|os.O_CREATE, 0o755)
463 require.NoError(t, err)
464 require.NoError(t, f.Close())
465
466 f, err = os.OpenFile(gitBin, os.O_RDONLY|os.O_CREATE, 0o755)
467 require.NoError(t, err)
468 require.NoError(t, f.Close())
469
470 tars := []string{
471 tmpDir + "/jellyfin-10.8.4-1-x86_64.pkg.tar.zst",
472 tmpDir + "/jellyfin-web-10.8.4-1-x86_64.pkg.tar.zst",
473 tmpDir + "/jellyfin-server-10.8.4-1-x86_64.pkg.tar.zst",
474 }
475
476 wantShow := []string{
477 "makepkg --verifysource --skippgpcheck -f -Cc",
478 "pacman -S --config /etc/pacman.conf -- community/dotnet-sdk-6.0 community/dotnet-runtime-6.0",
479 "pacman -D -q --asdeps --config /etc/pacman.conf -- dotnet-runtime-6.0 dotnet-sdk-6.0",
480 "makepkg --nobuild -f -C --ignorearch",
481 "makepkg -c --nobuild --noextract --ignorearch",
482 "makepkg --nobuild -f -C --ignorearch",
483 "makepkg -c --nobuild --noextract --ignorearch",
484 }
485
486 wantCapture := []string{
487 "makepkg --packagelist",
488 "git -C testdata/jfin git reset --hard HEAD",
489 "git -C testdata/jfin git merge --no-edit --ff",
490 "makepkg --packagelist",
491 }
492
493 captureOverride := func(cmd *exec.Cmd) (stdout string, stderr string, err error) {
494 return strings.Join(tars, "\n"), "", nil
495 }
496
497 once := sync.Once{}
498
499 showOverride := func(cmd *exec.Cmd) error {
500 once.Do(func() {
501 for _, tar := range tars {
502 f, err := os.OpenFile(tar, os.O_RDONLY|os.O_CREATE, 0o666)
503 require.NoError(t, err)
504 require.NoError(t, f.Close())
505 }
506 })
507 return nil
508 }
509
510 mockRunner := &exe.MockRunner{CaptureFn: captureOverride, ShowFn: showOverride}

Callers

nothing calls this directly

Calls 9

MakeArgumentsFunction · 0.92
AddArgMethod · 0.80
AddTargetMethod · 0.80
newTestLoggerFunction · 0.70
handleCmdFunction · 0.70
DoMethod · 0.65
LenMethod · 0.65
CloseMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected