Skip to content

Commit

Permalink
quick fixes for cli tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NorseGaud committed Dec 13, 2024
1 parent 175e6ce commit 65c0f8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ func main() {
if !strings.HasSuffix(loadedConfig.Log.FileDir, "/") {
loadedConfig.Log.FileDir += "/"
}
if _, err := os.Stat(loadedConfig.Log.FileDir); os.IsNotExist(err) {
parentLogger.ErrorContext(parentCtx, "log directory does not exist", "directory", loadedConfig.Log.FileDir)
os.Exit(1)
}
// logger, fileLocation, err = logging.UpdateLoggerToFile(logger, logFileDir, suffix)
// if err != nil {
// fmt.Printf("{\"time\":\"%s\",\"level\":\"ERROR\",\"msg\":\"%s\"}\n", time.Now().Format(time.RFC3339), err)
Expand Down Expand Up @@ -503,6 +507,7 @@ func worker(
if err != nil {
pluginLogger.ErrorContext(updatedPluginCtx, "error running plugin", "error", err)
pluginCancel()
workerCancel()
// Send SIGQUIT to the main pid
p, err := os.FindProcess(os.Getpid())
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tests/cli-test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ TESTS

run_test cli-test-no-log-directory.yml <<TESTS
log_contains "ERROR"
log_contains "open /tmp/doesntexist/anklet.log: no such file or directory"
log_contains "log directory does not exist"
log_does_not_contain "starting anklet"
TESTS

Expand Down

0 comments on commit 65c0f8d

Please sign in to comment.