diff --git a/cmd/insights/commands/root_test.go b/cmd/insights/commands/root_test.go index 061a6d0..bceed6c 100644 --- a/cmd/insights/commands/root_test.go +++ b/cmd/insights/commands/root_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/ubuntu/ubuntu-insights/internal/constants" ) @@ -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 diff --git a/cmd/insights/commands/upload.go b/cmd/insights/commands/upload.go index 0764afc..6f680c3 100644 --- a/cmd/insights/commands/upload.go +++ b/cmd/insights/commands/upload.go @@ -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, diff --git a/internal/collector/collector.go b/internal/collector/collector.go index 66f94de..8995073 100644 --- a/internal/collector/collector.go +++ b/internal/collector/collector.go @@ -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 diff --git a/internal/consent/consent.go b/internal/consent/consent.go index 42d2f3b..cfa37d9 100644 --- a/internal/consent/consent.go +++ b/internal/consent/consent.go @@ -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 diff --git a/internal/constants/constants_test.go b/internal/constants/constants_test.go index 3181da3..e8e46a6 100644 --- a/internal/constants/constants_test.go +++ b/internal/constants/constants_test.go @@ -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() @@ -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 }, @@ -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") }, }, } @@ -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() @@ -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": { diff --git a/internal/uploader/uploader.go b/internal/uploader/uploader.go index 01aafa6..b1c189e 100644 --- a/internal/uploader/uploader.go +++ b/internal/uploader/uploader.go @@ -1 +1,3 @@ +// Package uploader implements the uploader component. +// The uploader component is responsible for uploading reports to the Ubuntu Insights server. package uploader