mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
moved errorLog test to request testing
This commit is contained in:
parent
e6006b44d3
commit
f983148d46
2 changed files with 18 additions and 22 deletions
|
@ -108,7 +108,8 @@ func TestRequest(t *testing.T) {
|
|||
}
|
||||
defer ns.Shutdown()
|
||||
|
||||
tempdir := t.TempDir()
|
||||
// tempdir := t.TempDir()
|
||||
tempdir := "tmp"
|
||||
srv, conf := newServerForTesting(t, "127.0.0.1:42222", tempdir)
|
||||
srv.Start()
|
||||
defer srv.Stop()
|
||||
|
@ -126,6 +127,22 @@ func TestRequest(t *testing.T) {
|
|||
}
|
||||
|
||||
tests := []test{
|
||||
{
|
||||
info: "REQHello test",
|
||||
message: Message{
|
||||
ToNode: "errorCentral",
|
||||
FromNode: "errorCentral",
|
||||
Method: REQErrorLog,
|
||||
MethodArgs: []string{},
|
||||
MethodTimeout: 5,
|
||||
Data: []byte("error data"),
|
||||
// ReplyMethod: REQTest,
|
||||
Directory: "error_log",
|
||||
FileName: "error.results",
|
||||
}, want: []byte("error data"),
|
||||
containsOrEquals: fileContains,
|
||||
viaSocketOrCh: viaCh,
|
||||
},
|
||||
{
|
||||
info: "REQHello test",
|
||||
message: Message{
|
||||
|
|
|
@ -58,7 +58,6 @@ func TestStewardServer(t *testing.T) {
|
|||
|
||||
// Specify all the test funcs to run in the slice.
|
||||
funcs := []testFunc{
|
||||
checkREQErrorLogTest,
|
||||
checkREQTailFileTest,
|
||||
checkErrorKernelMalformedJSONtest,
|
||||
checkMetricValuesTest,
|
||||
|
@ -77,26 +76,6 @@ func TestStewardServer(t *testing.T) {
|
|||
// Check REQ types
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Check the error logger type.
|
||||
func checkREQErrorLogTest(stewardServer *server, conf *Configuration, t *testing.T, tempDir string) error {
|
||||
m := Message{
|
||||
ToNode: "somenode",
|
||||
}
|
||||
|
||||
p := newProcess(stewardServer.ctx, stewardServer, Subject{}, processKindSubscriber, nil)
|
||||
|
||||
stewardServer.errorKernel.errSend(p, m, fmt.Errorf("some error"))
|
||||
|
||||
resultFile := filepath.Join(conf.SubscribersDataFolder, "errorLog", "errorCentral", "error.log")
|
||||
_, err := findStringInFileTest("some error", resultFile, conf, t)
|
||||
if err != nil {
|
||||
return fmt.Errorf(" \U0001F631 [FAILED] : checkREQErrorLogTest: %v", err)
|
||||
}
|
||||
|
||||
t.Logf(" \U0001f600 [SUCCESS] : checkREQErrorLogTest\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check the tailing of files type.
|
||||
func checkREQTailFileTest(stewardServer *server, conf *Configuration, t *testing.T, tmpDir string) error {
|
||||
// Create a file with some content.
|
||||
|
|
Loading…
Reference in a new issue