Add log package for better logging level. (#1130)

* Add log package. Update worker with new log package.

* Add init error to worker.

* Init workers when binary launching.

* Add tests to cover different errors.
This commit is contained in:
Googol Lee
2024-11-21 10:44:38 +01:00
committed by GitHub
parent 0d69d5584e
commit a9d7b774bd
12 changed files with 289 additions and 110 deletions

View File

@@ -1,26 +0,0 @@
package test_utils
import (
"os"
"strings"
"testing"
)
func TestPathFromAPIRoot(t *testing.T) {
if got, want := PathFromAPIRoot("./server.go"), "/api/server.go"; !strings.HasSuffix(got, want) {
t.Fatalf(`PathFromAPIRoot("./server.go") = %q, want a suffix: %q`, got, want)
}
}
func TestSetPathWithCurrent(t *testing.T) {
pathDone := SetEnv("PATH", "")
defer pathDone()
testDone := SetPathWithCurrent("./test")
defer testDone()
path := os.Getenv("PATH")
if got, want := path, "api/test_utils/test"; !strings.HasSuffix(got, want) {
t.Errorf("path = %q, want a suffix: %q", got, want)
}
}