From 16c03bcd94f588cb467ad1a8fd84ec3689e30f2f Mon Sep 17 00:00:00 2001 From: Erik Kristensen Date: Sat, 26 Oct 2024 08:58:39 -0600 Subject: [PATCH] test: fix broken tests --- pkg/asset/asset_test.go | 4 ++-- pkg/osconfig/osconfig_test.go | 4 ++-- pkg/score/score_test.go | 2 +- pkg/source/github.go | 4 +++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/asset/asset_test.go b/pkg/asset/asset_test.go index f152787..b2d9f13 100644 --- a/pkg/asset/asset_test.go +++ b/pkg/asset/asset_test.go @@ -491,8 +491,8 @@ func TestAssetInstall(t *testing.T) { assert.NoError(t, err) for _, fileName := range c.expectedFiles { - destBinaryName := fmt.Sprintf("test-id-%s", filepath.Base(fileName)) - destBinPath := filepath.Join(binDir, destBinaryName) + destBinaryName := filepath.Base(fileName) + destBinPath := filepath.Join(optDir, destBinaryName) baseLinkName := filepath.Join(binDir, filepath.Base(fileName)) versionedLinkName := filepath.Join(binDir, fmt.Sprintf("%s@%s", filepath.Base(fileName), "1.0.0")) diff --git a/pkg/osconfig/osconfig_test.go b/pkg/osconfig/osconfig_test.go index b0d0180..38a9f72 100644 --- a/pkg/osconfig/osconfig_test.go +++ b/pkg/osconfig/osconfig_test.go @@ -137,7 +137,7 @@ func TestOS_InvalidOS(t *testing.T) { { name: "Windows", os: osconfig.New(osconfig.Windows, osconfig.AMD64), - expected: []string{osconfig.Linux, osconfig.Darwin}, + expected: []string{osconfig.Linux, osconfig.Darwin, osconfig.FreeBSD}, }, { name: "Linux", @@ -147,7 +147,7 @@ func TestOS_InvalidOS(t *testing.T) { { name: "Darwin", os: osconfig.New(osconfig.Darwin, osconfig.AMD64), - expected: []string{osconfig.Windows, osconfig.Linux}, + expected: []string{osconfig.Windows, osconfig.Linux, osconfig.FreeBSD}, }, } diff --git a/pkg/score/score_test.go b/pkg/score/score_test.go index 0b121b9..68e7cce 100644 --- a/pkg/score/score_test.go +++ b/pkg/score/score_test.go @@ -211,7 +211,7 @@ func TestScore(t *testing.T) { for _, c := range cases { t.Run(c.name, func(t *testing.T) { actual := Score(c.names, c.opts) - assert.Equal(t, c.expected, actual) + assert.ElementsMatch(t, c.expected, actual) }) } } diff --git a/pkg/source/github.go b/pkg/source/github.go index fa2dd88..9d70460 100644 --- a/pkg/source/github.go +++ b/pkg/source/github.go @@ -97,6 +97,8 @@ func (s *GitHub) FindRelease(ctx context.Context) error { var err error var release *github.RepositoryRelease + logrus.WithField("owner", s.GetOwner()).WithField("repo", s.GetRepo()).Trace("finding release") + if s.Version == provider.VersionLatest { release, _, err = s.client.Repositories.GetLatestRelease(ctx, s.GetOwner(), s.GetRepo()) if err != nil && !strings.Contains(err.Error(), "404 Not Found") { @@ -139,7 +141,7 @@ func (s *GitHub) FindRelease(ctx context.Context) error { return fmt.Errorf("release not found") } - log.Infof("installing version: %s", strings.TrimPrefix(release.GetTagName(), "v")) + log.Infof("selected version: %s", strings.TrimPrefix(release.GetTagName(), "v")) s.Release = release