main_test.go 557 B

1234567891011121314151617181920212223242526
  1. package main
  2. import (
  3. "testing"
  4. "github.com/mreiferson/go-options"
  5. "github.com/nsqio/nsq/internal/lg"
  6. "github.com/nsqio/nsq/internal/test"
  7. "github.com/nsqio/nsq/nsqlookupd"
  8. )
  9. func TestConfigFlagParsing(t *testing.T) {
  10. opts := nsqlookupd.NewOptions()
  11. opts.Logger = test.NewTestLogger(t)
  12. flagSet := nsqlookupdFlagSet(opts)
  13. flagSet.Parse([]string{})
  14. cfg := config{"log_level": "debug"}
  15. cfg.Validate()
  16. options.Resolve(opts, flagSet, cfg)
  17. if opts.LogLevel != lg.DEBUG {
  18. t.Fatalf("log level: want debug, got %s", opts.LogLevel.String())
  19. }
  20. }