mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 20:59:53 +05:00
revise failing integration test
failing due to 56dfa4ee21
warning error is not returned anymore, only logged
This commit is contained in:
committed by
Dan Christian Bogos
parent
56dfa4ee21
commit
47fb574aef
@@ -22,9 +22,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
package utils
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
@@ -63,6 +65,10 @@ func testWatchWatcherError(t *testing.T) {
|
||||
}
|
||||
|
||||
func testWatchWatcherEvents(t *testing.T) {
|
||||
tmpLog := Logger
|
||||
t.Cleanup(func() { Logger = tmpLog })
|
||||
buf := new(bytes.Buffer)
|
||||
Logger = NewStdLoggerWithWriter(buf, "", 4)
|
||||
watcher, err := fsnotify.NewWatcher()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -82,9 +88,12 @@ func testWatchWatcherEvents(t *testing.T) {
|
||||
}
|
||||
return fmt.Errorf("Can't match path")
|
||||
}
|
||||
expected := "Can't match path"
|
||||
if err := watch(EmptyString, EmptyString, f, watcher, stopWatching); err == nil || err.Error() != expected {
|
||||
t.Errorf("Expected %+v, received %+v", expected, err)
|
||||
if err := watch(EmptyString, EmptyString, f, watcher, stopWatching); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
expLog := `[WARNING] <> processing path </tmp/file.txt>, error: <Can't match path>`
|
||||
if !strings.Contains(buf.String(), expLog) {
|
||||
t.Errorf("expected %q to be present, received:\n%s", expLog, buf.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user