internal/server/boot/cli_test.go
Ref: Size: 746 B History
package boot
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// TestRunCLIBadFlag surfaces an unknown flag as an error rather than exiting the
// process (ContinueOnError).
func TestRunCLIBadFlag(t *testing.T) {
err := RunCLI([]string{"--nonesuch"})
require.Error(t, err)
}
// TestRunCLIMissingConfig threads the -config flag through to the loader and
// surfaces a missing config as an error naming the path (the process would then
// exit non-zero), without starting any listener.
func TestRunCLIMissingConfig(t *testing.T) {
missing := t.TempDir() + "/no-such-server.json"
err := RunCLI([]string{"-config", missing})
require.Error(t, err)
assert.Contains(t, err.Error(), missing)
}