mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-16 01:48:06 +02:00
Tests passing when being run offline, still not integrated with the new API endpoints yet
This commit is contained in:
@ -3,6 +3,7 @@ package shared
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
@ -103,7 +104,7 @@ func RunTestServer() func() {
|
||||
if err != nil && err.Error() != "os: process already finished" {
|
||||
panic(fmt.Sprintf("failed to kill server process: %v", err))
|
||||
}
|
||||
if strings.Contains(stderr.String()+stdout.String(), "failed to") {
|
||||
if strings.Contains(stderr.String()+stdout.String(), "failed to") && IsOnline() {
|
||||
panic(fmt.Sprintf("server failed to do something: stderr=%#v, stdout=%#v", stderr.String(), stdout.String()))
|
||||
}
|
||||
if strings.Contains(stderr.String()+stdout.String(), "ERROR:") {
|
||||
@ -126,3 +127,8 @@ func CheckWithInfo(t *testing.T, err error, additionalInfo string) {
|
||||
t.Fatalf("Unexpected error: %v at %s:%d! Additional info: %v", err, filename, line, additionalInfo)
|
||||
}
|
||||
}
|
||||
|
||||
func IsOnline() bool {
|
||||
_, err := http.Get("https://hishtory.dev")
|
||||
return err == nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user