forked from TrueCloudLab/neoneo-go
cli: do not run test server on windows
Currently we can't properly stop running server on Windows and SIGHUP is also not supported. This leads to occupied resources and failed test cleanup: ``` --- FAIL: TestServerStart (0.35s) --- FAIL: TestServerStart/good (0.10s) testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestServerStart_good337747932\001\neogotestchain\000001.log: The process cannot access the file because it is being used by another process. 2022-02-08T14:11:20.959+0300 INFO persisted to disk {"blocks": 0, "keys": 112, "headerHeight": 0, "blockHeight": 0, "took": "10.0049ms"} ```
This commit is contained in:
parent
8ff7cd865d
commit
d73f95e988
1 changed files with 27 additions and 23 deletions
|
@ -1,11 +1,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -96,6 +96,9 @@ func TestServerStart(t *testing.T) {
|
|||
e.RunWithError(t, baseCmd...)
|
||||
})
|
||||
})
|
||||
// We can't properly shutdown server on windows and release the resources.
|
||||
// Also, windows doesn't support SIGHUP and SIGINT.
|
||||
if runtime.GOOS != "windows" {
|
||||
t.Run("good", func(t *testing.T) {
|
||||
saveCfg(t, func(cfg *config.Config) {})
|
||||
|
||||
|
@ -107,7 +110,7 @@ func TestServerStart(t *testing.T) {
|
|||
require.Eventually(t, func() bool {
|
||||
line, err = e.Out.ReadString('\n')
|
||||
if err != nil && err != io.EOF {
|
||||
t.Fatalf(fmt.Sprintf("unexpected error while reading CLI output: %s", err))
|
||||
t.Fatalf("unexpected error while reading CLI output: %s", err)
|
||||
}
|
||||
return err == nil
|
||||
}, 2*time.Second, 100*time.Millisecond)
|
||||
|
@ -121,4 +124,5 @@ func TestServerStart(t *testing.T) {
|
|||
e.checkNextLine(t, "")
|
||||
e.checkEOF(t)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue