(t *testing.T)
| 33 | } |
| 34 | |
| 35 | func TestIntegrationLocalInstall(t *testing.T) { |
| 36 | makepkgBin := t.TempDir() + "/makepkg" |
| 37 | pacmanBin := t.TempDir() + "/pacman" |
| 38 | gitBin := t.TempDir() + "/git" |
| 39 | tmpDir := t.TempDir() |
| 40 | f, err := os.OpenFile(makepkgBin, os.O_RDONLY|os.O_CREATE, 0o755) |
| 41 | require.NoError(t, err) |
| 42 | require.NoError(t, f.Close()) |
| 43 | |
| 44 | f, err = os.OpenFile(pacmanBin, os.O_RDONLY|os.O_CREATE, 0o755) |
| 45 | require.NoError(t, err) |
| 46 | require.NoError(t, f.Close()) |
| 47 | |
| 48 | f, err = os.OpenFile(gitBin, os.O_RDONLY|os.O_CREATE, 0o755) |
| 49 | require.NoError(t, err) |
| 50 | require.NoError(t, f.Close()) |
| 51 | |
| 52 | tars := []string{ |
| 53 | tmpDir + "/jellyfin-10.8.4-1-x86_64.pkg.tar.zst", |
| 54 | tmpDir + "/jellyfin-web-10.8.4-1-x86_64.pkg.tar.zst", |
| 55 | tmpDir + "/jellyfin-server-10.8.4-1-x86_64.pkg.tar.zst", |
| 56 | } |
| 57 | |
| 58 | wantShow := []string{ |
| 59 | "makepkg --verifysource --skippgpcheck -f -Cc", |
| 60 | "pacman -S --config /etc/pacman.conf -- community/dotnet-sdk-6.0 community/dotnet-runtime-6.0", |
| 61 | "pacman -D -q --asdeps --config /etc/pacman.conf -- dotnet-runtime-6.0 dotnet-sdk-6.0", |
| 62 | "makepkg --nobuild -f -C --ignorearch", |
| 63 | "makepkg -c --nobuild --noextract --ignorearch", |
| 64 | "pacman -U --config /etc/pacman.conf -- /testdir/jellyfin-server-10.8.4-1-x86_64.pkg.tar.zst /testdir/jellyfin-web-10.8.4-1-x86_64.pkg.tar.zst", |
| 65 | "pacman -D -q --asexplicit --config /etc/pacman.conf -- jellyfin-server jellyfin-web", |
| 66 | "makepkg --nobuild -f -C --ignorearch", |
| 67 | "makepkg -c --nobuild --noextract --ignorearch", |
| 68 | "pacman -U --config /etc/pacman.conf -- /testdir/jellyfin-10.8.4-1-x86_64.pkg.tar.zst", |
| 69 | "pacman -D -q --asexplicit --config /etc/pacman.conf -- jellyfin", |
| 70 | } |
| 71 | |
| 72 | wantCapture := []string{ |
| 73 | "makepkg --packagelist", |
| 74 | "git -C testdata/jfin git reset --hard HEAD", |
| 75 | "git -C testdata/jfin git merge --no-edit --ff", |
| 76 | "makepkg --packagelist", |
| 77 | } |
| 78 | |
| 79 | captureOverride := func(cmd *exec.Cmd) (stdout string, stderr string, err error) { |
| 80 | return strings.Join(tars, "\n"), "", nil |
| 81 | } |
| 82 | |
| 83 | once := sync.Once{} |
| 84 | |
| 85 | showOverride := func(cmd *exec.Cmd) error { |
| 86 | once.Do(func() { |
| 87 | for _, tar := range tars { |
| 88 | f, err := os.OpenFile(tar, os.O_RDONLY|os.O_CREATE, 0o666) |
| 89 | require.NoError(t, err) |
| 90 | require.NoError(t, f.Close()) |
| 91 | } |
| 92 | }) |
nothing calls this directly
no test coverage detected