Merge pull request #40 from gogrlx/cd/fix-ci-failures

fix(ci): update integration tests for NameNormalizer, fix lint and Windows CI
This commit is contained in:
2026-03-05 23:15:28 -05:00
committed by GitHub
8 changed files with 9 additions and 40 deletions

View File

@@ -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()

View File

@@ -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))

View File

@@ -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")
}

View File

@@ -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.

View File

@@ -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
}

View File

@@ -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))

View File

@@ -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))

View File

@@ -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))