Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Schmidt committed Jun 13, 2024
1 parent 419a1b5 commit 089105e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ func Execute() {
}

func init() {
rootCmd.PersistentFlags().Var(&rootFlags.logLevel, logLevelFlagName, common.DefaultWrapHelpString(fmt.Sprintf("Log level for additional details and debugging. Valid values: %s", strings.Join(flags.LogLevelEnum(), ", "))))
rootCmd.PersistentFlags().Var(
&rootFlags.logLevel,
logLevelFlagName,
common.DefaultWrapHelpString(fmt.Sprintf("Log level for additional details and debugging. Valid values: %s", strings.Join(flags.LogLevelEnum(), ", "))) //nolint:lll // For readability

Check failure on line 92 in cmd/root.go

View workflow job for this annotation

GitHub Actions / tests

syntax error: unexpected newline in argument list; possibly missing comma or )

Check failure on line 92 in cmd/root.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in argument list; possibly missing comma or ) (typecheck)

Check failure on line 92 in cmd/root.go

View workflow job for this annotation

GitHub Actions / lint

missing ',' before newline in argument list (typecheck)

Check failure on line 92 in cmd/root.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in argument list; possibly missing comma or )) (typecheck)

Check failure on line 92 in cmd/root.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in argument list; possibly missing comma or ) (typecheck)

Check failure on line 92 in cmd/root.go

View workflow job for this annotation

GitHub Actions / lint

missing ',' before newline in argument list (typecheck)

Check failure on line 92 in cmd/root.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in argument list; possibly missing comma or )) (typecheck)
)
common.SetupRoot(rootCmd, "aerospike-vector-search", "0.0.0") // TODO: Handle version
viper.SetEnvPrefix("ASVEC")

Expand Down
49 changes: 49 additions & 0 deletions cmd/utils_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//go:build unit

package cmd

import (
"asvec/cmd/flags"
"testing"

avs "github.com/aerospike/aerospike-proximus-client-go"
"github.com/stretchr/testify/assert"
)

func TestParseBothHostSeedsFlag(t *testing.T) {
testCases := []struct {
seeds *flags.SeedsSliceFlag
host *flags.HostPortFlag
expectedSlice avs.HostPortSlice
expectedIsLoadBalancer bool
}{
{
&flags.SeedsSliceFlag{
Seeds: avs.HostPortSlice{
avs.NewHostPort("1.1.1.1", 5000, false),
},
},
flags.NewDefaultHostPortFlag(),
avs.HostPortSlice{
avs.NewHostPort("1.1.1.1", 5000, false),
},
false,
},
{
&flags.SeedsSliceFlag{
Seeds: avs.HostPortSlice{},
},
flags.NewDefaultHostPortFlag(),
avs.HostPortSlice{
&flags.NewDefaultHostPortFlag().HostPort,
},
true,
},
}

for _, tc := range testCases {
actualSlice, actualBool := parseBothHostSeedsFlag(tc.seeds, tc.host)
assert.Equal(t, tc.expectedSlice, actualSlice)
assert.Equal(t, tc.expectedIsLoadBalancer, actualBool)
}
}

0 comments on commit 089105e

Please sign in to comment.