Log fx's startup steps at debug; a refused setting is one line (closes #209)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
fx's event lines, errors included, now log at debug level, so a normal start shows none and DEBUG shows them. RunServer starts and stops the fx app itself instead of calling Run, and logs fx's "received signal" line as Run did. When the start fails, it logs the error's root cause as one "cannot start" line, the backend's last, and returns 1. Main returns the server's exit code. Model: opus-5-5
This commit was merged in pull request #219.
This commit is contained in:
1 parent
d33328ec17
commit
cdabf019bb
5 files changed
+216
-41
No files matched your search
@@ -63,7 +63,7 @@ func TestMainRunsPrepareDataDir(t *testing.T) {
|
||||
|
||||
// TestMainRunsServerWithNoArguments: Main given no arguments starts the
|
||||
// server with the name and version it was given, writes nothing and
|
||||
// returns 0.
|
||||
// returns the server's exit code.
|
||||
func TestMainRunsServerWithNoArguments(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -73,11 +73,13 @@ func TestMainRunsServerWithNoArguments(t *testing.T) {
|
||||
)
|
||||
|
||||
code := cli.Main(&stderr, "netwatch", "test", []string{},
|
||||
func(appname, version string) {
|
||||
func(appname, version string) int {
|
||||
gotAppname, gotVersion = appname, version
|
||||
|
||||
return 3
|
||||
})
|
||||
if code != 0 || stderr.Len() != 0 {
|
||||
t.Errorf("exit %d, stderr %q; want exit 0 and no output",
|
||||
if code != 3 || stderr.Len() != 0 {
|
||||
t.Errorf("exit %d, stderr %q; want exit 3 and no output",
|
||||
code, stderr.String())
|
||||
}
|
||||
|
||||
@@ -210,10 +212,12 @@ func currentUsername(t *testing.T) string {
|
||||
|
||||
// failIfServerStarts is what the tests give Main in place of
|
||||
// cli.RunServer: it fails the test instead of starting the server.
|
||||
func failIfServerStarts(t *testing.T) func(appname, version string) {
|
||||
func failIfServerStarts(t *testing.T) func(appname, version string) int {
|
||||
t.Helper()
|
||||
|
||||
return func(string, string) {
|
||||
return func(string, string) int {
|
||||
t.Error("Main started the server")
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user