Skip to content

Commit

Permalink
Merge pull request #5 from ubuntu/UDENG-5778-fixes-to-pass-ci
Browse files Browse the repository at this point in the history
fix: Fix constants test for windows, linter fixes
  • Loading branch information
hk21702 authored Jan 14, 2025
2 parents 7aa873b + b2da456 commit 716f014
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion cmd/insights/commands/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/ubuntu/ubuntu-insights/internal/constants"
)

Expand Down Expand Up @@ -49,7 +50,7 @@ func TestSetVerbosity(t *testing.T) {

func TestUsageError(t *testing.T) {
app, err := New()
assert.NoError(t, err)
require.NoError(t, err)

// Test when SilenceUsage is true
app.rootCmd.SilenceUsage = true
Expand Down
2 changes: 1 addition & 1 deletion cmd/insights/commands/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func installUploadCmd(app *App) {
app.uploadConfig = defaultUploadConfig

uploadCmd := &cobra.Command{
Use: "upload upload [sources](optional arguments)",
Use: "upload [sources](optional arguments)",
Short: "Upload metrics to the Ubuntu Insights server",
Long: "Upload metrics to the Ubuntu Insights server",
Args: cobra.ArbitraryArgs,
Expand Down
2 changes: 2 additions & 0 deletions internal/collector/collector.go
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// Package collector is the implementation of the collector component.
// The collector component is responsible for collecting data from sources, merging it into a report, and then writing the report to disk.
package collector
2 changes: 2 additions & 0 deletions internal/consent/consent.go
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// Package consent is the implementation of the consent manager component.
// The consent manager is responsible for managing consent files, which are used to store the consent state for a source or the global consent state.
package consent
12 changes: 5 additions & 7 deletions internal/constants/constants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package constants_test

import (
"fmt"
"os"
"path/filepath"
"testing"

"github.com/stretchr/testify/require"
"github.com/ubuntu/ubuntu-insights/internal/constants"
)

//nolint:dupl //Tests for GetDefaultConfigPath is very similar to GetDefaultCachePath.
func Test_GetDefaultConfigPath(t *testing.T) {
t.Parallel()

Expand All @@ -18,7 +17,7 @@ func Test_GetDefaultConfigPath(t *testing.T) {
mock func() (string, error)
}{
"os.UserConfigDir success": {
want: "abc/def" + string(os.PathSeparator) + constants.DefaultAppFolder,
want: filepath.Join("abc", "def", constants.DefaultAppFolder),
mock: func() (string, error) {
return "abc/def", nil
},
Expand All @@ -32,7 +31,7 @@ func Test_GetDefaultConfigPath(t *testing.T) {
"os.UserConfigDir error 2": {
want: constants.DefaultAppFolder,
mock: func() (string, error) {
return "abc", fmt.Errorf("os.UserCacheDir error")
return filepath.Join("abc", "def"), fmt.Errorf("os.UserCacheDir error")
},
},
}
Expand All @@ -46,7 +45,6 @@ func Test_GetDefaultConfigPath(t *testing.T) {
}
}

//nolint:dupl //Tests for GetDefaultConfigPath is very similar to GetDefaultCachePath.
func Test_GetDefaultCachePath(t *testing.T) {
t.Parallel()

Expand All @@ -55,9 +53,9 @@ func Test_GetDefaultCachePath(t *testing.T) {
mock func() (string, error)
}{
"os.UserCacheDir success": {
want: "def/abc" + string(os.PathSeparator) + constants.DefaultAppFolder,
want: filepath.Join("abc", "def", constants.DefaultAppFolder),
mock: func() (string, error) {
return "def/abc", nil
return filepath.Join("abc", "def"), nil
},
},
"os.UserCacheDir error": {
Expand Down
2 changes: 2 additions & 0 deletions internal/uploader/uploader.go
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// Package uploader implements the uploader component.
// The uploader component is responsible for uploading reports to the Ubuntu Insights server.
package uploader

0 comments on commit 716f014

Please sign in to comment.