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:
Anna Shaleva 2022-02-08 17:03:17 +03:00 committed by Anna Shaleva
parent 8ff7cd865d
commit d73f95e988

View file

@ -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)
@ -122,3 +125,4 @@ func TestServerStart(t *testing.T) {
e.checkEOF(t)
})
}
}