Conversation
# Conflicts: # go.mod # go.sum
| } | ||
|
|
||
| type cmdWithDefaultsApply struct { | ||
| applyDefaultCalled bool |
There was a problem hiding this comment.
why don't use mock libraries?
|
|
||
| cmd := &addMySQLCommand{} | ||
|
|
||
| commands.ConfigureDefaults(file.Name(), cmd) |
There was a problem hiding this comment.
🚫 [golangci-lint] reported by reviewdog 🐶
Error return value of commands.ConfigureDefaults is not checked (errcheck)
| Password: "default-password", | ||
| } | ||
|
|
||
| commands.ConfigureDefaults(file.Name(), cmd) |
There was a problem hiding this comment.
🚫 [golangci-lint] reported by reviewdog 🐶
Error return value of commands.ConfigureDefaults is not checked (errcheck)
| Password: "default-password", | ||
| } | ||
|
|
||
| commands.ConfigureDefaults(file.Name(), cmd) |
There was a problem hiding this comment.
🚫 [golangci-lint] reported by reviewdog 🐶
Error return value of commands.ConfigureDefaults is not checked (errcheck)
| }) | ||
| } | ||
|
|
||
| func TestApplyDefaults(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci-lint] reported by reviewdog 🐶
Function 'TestApplyDefaults' is too long (86 > 60) (funlen)
| Run() (Result, error) | ||
| } | ||
|
|
||
| type ApplyDefaults interface { |
There was a problem hiding this comment.
🚫 [golangci-lint] reported by reviewdog 🐶
exported type ApplyDefaults should have comment or be unexported (golint)
| } | ||
|
|
||
| func TestConfigureDefaults(t *testing.T) { | ||
| t.Run("ApplyDefaults is called if command supports it", func(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci-lint] reported by reviewdog 🐶
Function TestConfigureDefaults has missing the call to method parallel in the test run (paralleltest)
| assert.Equal(t, "toor", cmd.password) | ||
| }) | ||
|
|
||
| t.Run("ApplyDefaults is not called if pass is not setup", func(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci-lint] reported by reviewdog 🐶
Function TestConfigureDefaults has missing the call to method parallel in the test run (paralleltest)
| }) | ||
| } | ||
|
|
||
| func TestExpandPath(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci-lint] reported by reviewdog 🐶
Function TestExpandPath missing the call to method parallel (paralleltest)
| } | ||
|
|
||
| func TestExpandPath(t *testing.T) { | ||
| t.Run("relative to userhome", func(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci-lint] reported by reviewdog 🐶
Function TestExpandPath has missing the call to method parallel in the test run (paralleltest)
|
|
||
| assert.Equal(t, usr.HomeDir, actual) | ||
| }) | ||
| t.Run("relative to userhome", func(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci-lint] reported by reviewdog 🐶
Function TestExpandPath has missing the call to method parallel in the test run (paralleltest)
|
|
||
| func TestConfigureDefaults(t *testing.T) { | ||
| t.Run("ApplyDefaults is called if command supports it", func(t *testing.T) { | ||
| file, e := os.Open("../testdata/.my.cnf") |
There was a problem hiding this comment.
@BupycHuk you were asking for it. I use real file in cmd test, but tmp files for commands/management/add_mysql.go
| }) | ||
| } | ||
|
|
||
| func TestApplyDefaults(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci-lint] reported by reviewdog 🐶
Function 'TestApplyDefaults' is too long (81 > 60) (funlen)
| @@ -0,0 +1,5 @@ | |||
| [client] | |||
There was a problem hiding this comment.
| return fmt.Sprintf("errFromNginx(%q)", string(e)) | ||
| } | ||
|
|
||
| func ConfigureDefaults(config string, cmd ApplyDefaults) error { |
There was a problem hiding this comment.
i think its better to rename it to configPath
| "testing" | ||
|
|
||
| "gopkg.in/ini.v1" | ||
|
|
There was a problem hiding this comment.
let's remove this blank line
| } | ||
|
|
||
| type cmdWithDefaultsApply struct { | ||
| applyDefaultCalled bool |
There was a problem hiding this comment.
why don't use mock libraries?
|
|
||
| assert.Equal(t, usr.HomeDir, actual) | ||
| }) | ||
| t.Run("relative to userhome", func(t *testing.T) { |
There was a problem hiding this comment.
it doesn't look relative to userhome
| "github.com/sirupsen/logrus" | ||
|
|
||
| "gopkg.in/ini.v1" | ||
|
|
||
| "github.com/percona/pmm-admin/agentlocal" | ||
|
|
There was a problem hiding this comment.
please fix imports to split them in 3 blocks
- go libs
- 3rd party libs
- local packages
Jira Ticket and related ticket
FB
commands.ApplyDefaults