# Print out and compare logged config set via config file that includes invalid values
karma.bin-should-fail-no-timestamp --config.file=karma.yaml --check-config
! stdout .
cmp stderr expected.stderr

-- karma.yaml --
alertmanager:
  interval: jjs88
  servers:
    - name: ha1
      uri: "http://localhost:9093"
      timeout: bbb
      proxy: YEs
      cors:
        credentials: foo
    - name: ha2
      uri: "http://localhost:9094"
      timeout: 11
      readonly: 1
    - name: local
      uri: http://localhost:9095
      timeout: z
      proxy: true
      readonly: 0
      headers:
        - X-Auth-Test=some-token-or-other-string
    - name: client-auth
      uri: https://localhost:9096
      timeout: 10s
      tls:
        ca: ca.pem
        cert: cert.pem
        key: key.pem
alertAcknowledgement:
  enabled: zzz
  duration: 7m0s
  author: karma
  commentPrefix: ACK!
annotations:
  default:
    hidden: z
  hidden: {}
  visible:
    - visible
filters:
  default: []
karma:
  name: karma-demo
log:
  level: 123
  format: foo
ui:
  refresh: 10sm
  hideFiltersWhenIdle: z
  colorTitlebar: yum
  theme: x
  minimalGroupWidth: abc4
  alertsPerGroup: 5a
  collapseGroups: collapsedOanMobile

-- expected.stderr --
level=fatal msg="Failed to unmarshal configuration: 12 error(s) decoding:\n\n* 'Alertmanager.Servers[2].Headers[0]' expected a map, got 'string'\n* cannot parse 'Alertmanager.Servers[0].Proxy' as bool: strconv.ParseBool: parsing \"YEs\": invalid syntax\n* cannot parse 'Annotations.Default.Hidden' as bool: strconv.ParseBool: parsing \"z\": invalid syntax\n* cannot parse 'UI.alertsPerGroup' as int: strconv.ParseInt: parsing \"5a\": invalid syntax\n* cannot parse 'UI.colorTitlebar' as bool: strconv.ParseBool: parsing \"yum\": invalid syntax\n* cannot parse 'UI.hideFiltersWhenIdle' as bool: strconv.ParseBool: parsing \"z\": invalid syntax\n* cannot parse 'UI.minimalGroupWidth' as int: strconv.ParseInt: parsing \"abc4\": invalid syntax\n* cannot parse 'alertAcknowledgement.Enabled' as bool: strconv.ParseBool: parsing \"zzz\": invalid syntax\n* error decoding 'Alertmanager.Interval': time: invalid duration jjs88\n* error decoding 'Alertmanager.Servers[0].Timeout': time: invalid duration bbb\n* error decoding 'Alertmanager.Servers[2].Timeout': time: invalid duration z\n* error decoding 'UI.Refresh': time: unknown unit sm in duration 10sm"
level=fatal msg="Invalid alertmanager.cors.credentials value '', allowed options: omit, inclue, same-origin"
level=fatal msg="Invalid grid.sorting.order value '', allowed options: disabled, startsAt, label"
level=fatal msg="Invalid ui.collapseGroups value '', allowed options: expanded, collapsed, collapsedOnMobile"
level=fatal msg="Invalid ui.theme value '', allowed options: light, dark, auto"
level=error msg="Unknown log level ''"
