mirror of https://github.com/docker/compose.git
watch: fix a dumb errcheck (#3622)
This commit is contained in:
parent
b3615d64e2
commit
8b39322365
|
@ -80,7 +80,7 @@ func DesiredWindowsBufferSize() int {
|
|||
envVar := os.Getenv(WindowsBufferSizeEnvVar)
|
||||
if envVar != "" {
|
||||
size, err := strconv.Atoi(envVar)
|
||||
if err != nil {
|
||||
if err == nil {
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,20 @@ import (
|
|||
// Each implementation of the notify interface should have the same basic
|
||||
// behavior.
|
||||
|
||||
func TestWindowsBufferSize(t *testing.T) {
|
||||
orig := os.Getenv(WindowsBufferSizeEnvVar)
|
||||
defer os.Setenv(WindowsBufferSizeEnvVar, orig)
|
||||
|
||||
os.Setenv(WindowsBufferSizeEnvVar, "")
|
||||
assert.Equal(t, defaultBufferSize, DesiredWindowsBufferSize())
|
||||
|
||||
os.Setenv(WindowsBufferSizeEnvVar, "a")
|
||||
assert.Equal(t, defaultBufferSize, DesiredWindowsBufferSize())
|
||||
|
||||
os.Setenv(WindowsBufferSizeEnvVar, "10")
|
||||
assert.Equal(t, 10, DesiredWindowsBufferSize())
|
||||
}
|
||||
|
||||
func TestNoEvents(t *testing.T) {
|
||||
f := newNotifyFixture(t)
|
||||
defer f.tearDown()
|
||||
|
|
Loading…
Reference in New Issue