diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 5296e6c..aca63fa 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -211,6 +211,7 @@ jobs: with: go-version-file: go.mod - name: Unit tests + shell: bash run: go test -race -coverprofile=coverage-windows.out ./winget/ ./detect/ - uses: actions/upload-artifact@v4 if: always() diff --git a/apk/apk_integration_test.go b/apk/apk_integration_test.go index 38472ff..b47b9dd 100644 --- a/apk/apk_integration_test.go +++ b/apk/apk_integration_test.go @@ -29,7 +29,7 @@ func TestIntegration_Apk(t *testing.T) { assert.False(t, caps.RepoManagement, "apk should not support RepoManagement") assert.False(t, caps.KeyManagement, "apk should not support KeyManagement") assert.False(t, caps.Groups, "apk should not support Groups") - assert.False(t, caps.NameNormalize, "apk should not support NameNormalize") + assert.True(t, caps.NameNormalize, "apk should support NameNormalize") t.Run("Update", func(t *testing.T) { require.NoError(t, mgr.Update(ctx)) diff --git a/aur/aur_linux.go b/aur/aur_linux.go index c974918..aef5cc9 100644 --- a/aur/aur_linux.go +++ b/aur/aur_linux.go @@ -11,7 +11,6 @@ import ( "net/http" "os" "os/exec" - "path/filepath" "strings" "github.com/gogrlx/snack" @@ -380,14 +379,4 @@ func upgradePackages(ctx context.Context, pkgs []snack.Target, opts ...snack.Opt return install(ctx, pkgs, allOpts...) } -// getAURBuildDir returns the directory to use for AUR builds. -func getAURBuildDir() string { - if dir := os.Getenv("AURDEST"); dir != "" { - return dir - } - if cache := os.Getenv("XDG_CACHE_HOME"); cache != "" { - return filepath.Join(cache, "aur") - } - home, _ := os.UserHomeDir() - return filepath.Join(home, ".cache", "aur") -} + diff --git a/aur/capabilities.go b/aur/capabilities.go index ec51d82..b28ce9b 100644 --- a/aur/capabilities.go +++ b/aur/capabilities.go @@ -34,8 +34,8 @@ func (a *AUR) Autoremove(ctx context.Context, opts ...snack.Option) error { } // Clean is a no-op for AUR (builds use temp directories). -func (a *AUR) Clean(_ context.Context) error { - return nil +func (a *AUR) Clean(ctx context.Context) error { + return clean(ctx) } // UpgradePackages rebuilds and reinstalls specific AUR packages. diff --git a/aur/rpc.go b/aur/rpc.go index 29a4c12..87d173d 100644 --- a/aur/rpc.go +++ b/aur/rpc.go @@ -7,7 +7,6 @@ import ( "io" "net/http" "net/url" - "strings" "github.com/gogrlx/snack" ) @@ -117,23 +116,3 @@ func rpcInfo(ctx context.Context, pkg string) (*snack.Package, error) { return &p, nil } -// rpcInfoMulti returns info about multiple AUR packages in a single request. -func rpcInfoMulti(ctx context.Context, pkgs []string) (map[string]rpcResult, error) { - if len(pkgs) == 0 { - return nil, nil - } - params := make([]string, len(pkgs)) - for i, p := range pkgs { - params[i] = "arg[]=" + url.QueryEscape(p) - } - endpoint := rpcBaseURL + "/info?" + strings.Join(params, "&") - resp, err := rpcGet(ctx, endpoint) - if err != nil { - return nil, err - } - result := make(map[string]rpcResult, len(resp.Results)) - for _, r := range resp.Results { - result[r.Name] = r - } - return result, nil -} diff --git a/flatpak/flatpak_integration_test.go b/flatpak/flatpak_integration_test.go index ffff002..d7b2ec0 100644 --- a/flatpak/flatpak_integration_test.go +++ b/flatpak/flatpak_integration_test.go @@ -24,12 +24,12 @@ func TestIntegration_Flatpak(t *testing.T) { caps := snack.GetCapabilities(mgr) assert.True(t, caps.Clean, "flatpak should support Clean") assert.True(t, caps.RepoManagement, "flatpak should support RepoManagement") - assert.False(t, caps.VersionQuery) + assert.True(t, caps.VersionQuery, "flatpak should support VersionQuery") assert.False(t, caps.Hold) assert.False(t, caps.FileOwnership) assert.False(t, caps.KeyManagement) assert.False(t, caps.Groups) - assert.False(t, caps.NameNormalize) + assert.True(t, caps.NameNormalize, "flatpak should support NameNormalize") t.Run("Update", func(t *testing.T) { require.NoError(t, mgr.Update(ctx)) diff --git a/pacman/pacman_integration_test.go b/pacman/pacman_integration_test.go index 86a883b..1b1bcaf 100644 --- a/pacman/pacman_integration_test.go +++ b/pacman/pacman_integration_test.go @@ -29,7 +29,7 @@ func TestIntegration_Pacman(t *testing.T) { assert.False(t, caps.Hold, "pacman should not support Hold") assert.False(t, caps.RepoManagement, "pacman should not support RepoManagement") assert.False(t, caps.KeyManagement, "pacman should not support KeyManagement") - assert.False(t, caps.NameNormalize, "pacman should not support NameNormalize") + assert.True(t, caps.NameNormalize, "pacman should support NameNormalize") t.Run("Update", func(t *testing.T) { require.NoError(t, mgr.Update(ctx)) diff --git a/snap/snap_integration_test.go b/snap/snap_integration_test.go index cfd6d0c..429af6a 100644 --- a/snap/snap_integration_test.go +++ b/snap/snap_integration_test.go @@ -29,7 +29,7 @@ func TestIntegration_Snap(t *testing.T) { assert.False(t, caps.RepoManagement) assert.False(t, caps.KeyManagement) assert.False(t, caps.Groups) - assert.False(t, caps.NameNormalize) + assert.True(t, caps.NameNormalize, "snap should support NameNormalize") t.Run("Update", func(t *testing.T) { require.NoError(t, mgr.Update(ctx))