config: return correct error
_conmonVersionFormatErr is a format string and it needs an error argument. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
815258862e
commit
e4edaae628
|
|
@ -459,7 +459,7 @@ func probeConmon(conmonBinary string) error {
|
|||
|
||||
matches := r.FindStringSubmatch(out.String())
|
||||
if len(matches) != 5 {
|
||||
return errors.New(_conmonVersionFormatErr)
|
||||
return fmt.Errorf(_conmonVersionFormatErr, errors.New("invalid version format"))
|
||||
}
|
||||
major, err := strconv.Atoi(matches[2])
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
|
@ -57,7 +58,8 @@ func TestProbeConmon(t *testing.T) {
|
|||
msg: "failure invalid format",
|
||||
output: "invalid",
|
||||
assert: func(err error, msg string) {
|
||||
assert.EqualError(t, err, _conmonVersionFormatErr, msg)
|
||||
expectedErr := fmt.Errorf(_conmonVersionFormatErr, errors.New("invalid version format"))
|
||||
assert.Equal(t, err, expectedErr, msg)
|
||||
},
|
||||
},
|
||||
} {
|
||||
|
|
|
|||
Loading…
Reference in New Issue