# Config is valid with example silence ACL rules
exec karma --check-config
! stdout .
cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Reading configuration file" path=karma.yaml
level=INFO msg="Version: dev"
level=INFO msg="Configured Alertmanager source" name=default cluster=default uri=https://127.0.0.1:9093 proxy=false readonly=false
level=INFO msg="Reading silence ACL config file" path=acl.yaml
level=INFO msg="Parsed ACL rules" rules=6
level=INFO msg="Configuration is valid"
-- karma.yaml --
authentication:
  header:
    name: "X-User"
    value_re: "(.+)"
authorization:
  groups:
    - name: admins
      members:
        - alice
        - bob
    - name: users
      members:
        - john
  acl:
    silences: acl.yaml
alertmanager:
  servers:
    - name: default
      uri: https://127.0.0.1:9093


-- acl.yaml --
rules:
  - action: requireMatcher
    reason: require cluster=~dev|prod for admins
    scope:
      filters:
        - name: cluster
          value_re: .+
      alertmanagers:
        - default
      groups:
        - admins
    matchers:
      required:
        - name: cluster
          value: dev|prod
          isRegex: true
  - action: block
    reason: block cluster=prod for users
    scope:
      filters:
        - name: cluster
          value: prod
      groups:
        - users
  - action: requireMatcher
    reason: cluster label is required for all silences
    matchers:
      required:
        - name: cluster
          value_re: .+
  - action: requireMatcher
    reason: at least one matcher is required for all silences
    matchers:
      required:
        - name_re: .+
          value_re: .+
  - action: block
    reason: block negative matchers
    scope:
      filters:
        - name_re: .+
          value_re: .+
          isEqual: false
  - action: requireMatcher
    reason: require positive matcher
    matchers:
      required:
        - name_re: .+
          value_re: .+
          isEqual: true
