# This sample goss.yaml file is used to test the json schema goss-json-schema.yaml

addr:
  tcp:
    reachable: true
    timeout: 500
    local-address: 127.0.0.1

command:
  version:
    # required attributes
    exit-status: 0
    # defaults to hash key
    exec: "go version"
    # optional attributes
    stdout:
      - go version go1.6 linux/amd64
    stderr: []
    timeout: 10000 # in milliseconds
    skip: false

dns:
  localhost:
    addrs:
      - ::1
    resolvable: true

file:
  /ect/password/static:
    exists: true
    mode: "0644"
    size: 2118
    owner: root
    group: root
    filetype: file
    contains:
      - hrll
    md5: 7c9bb14b3bf178e82c00c2a4398c93cd
    sha256: 7f78ce27859049f725936f7b52c6e25d774012947d915e7b394402cfceb70c4c
    sha512: cb71b1940dc879a3688bd502846bff6316dd537bbe917484964fe0f098e9245d80958258dc3bd6297bf42d5bd978cbe2c03d077d4ed45b2b1ed9cd831ceb1bd0
    linked-to: /usr/sbin/sendmail.sendmail
    skip: false
# Inline templates are not valid json/yaml that could be validated as-in by json schema
# Instead, run `goss --vars ./vars.yaml render > rendered_goss.yaml` to render them
# and apply the schema validation on the rendered file.
{{- range mkSlice "/etc/passwd" "/etc/group"}}
  {{.}}:
    exists: true
    mode: "0644"
    owner: root
    group: root
    filetype: file
{{end}}

gossfile:
  myapplication:
    file: myapp_gossfile.yaml
    skip: false

group:
  nfsnobody:
    exists: true
    skip: false
    gid: 65534
  nobody:
    exists: true
    

http:
  https://www.google.com:
    status: 200
    allow-insecure: false
    no-follow-redirects: false
    timeout: 1000
    username: ""
    password: ""
    ca-file: ""
    cert-file: ""
    key-file: ""
    proxy: ""
    skip: false
    method: GET

interface:
  eth0:
    exists: true
    addrs:
      - " 1"
    mtu: 1500

kernel-param:
  kernel.ostype:
    value: Linux

matching:
  check_instance_count:
    content: {{ .Vars.instance_count }}
    matches:
      gt: 0
  check_failure_count_from_all_instance:
    content: {{ .Vars.failures }}
    matches: 0
  check_status:
    content: {{ .Vars.status }}
    matches:
      - not: FAIL
  example:
    content:
      - 1.0.1
      - 1.9.9
    matches:
      semver-constraint: ">1.0.0 <2.0.0 !=1.5.0"
  has_substr: # friendly test name
    content: some string
    matches:
      match-regexp: some str
  has_2:
    content:
      - 2
    matches:
      contain-element: 2
  has_foo_bar_and_baz:
    content:
      foo: bar
      baz: bing
    matches:
      and:
        - have-key-with-value:
            foo: bar
        - have-key: baz

# TODO: sprig syntax fails to accept upper block below
# https://github.com/goss-org/goss/blob/master/docs/manual.md#examples-2
#  sping_basic:
#    content: { { "hello!" | upper | repeat 5 }}
#                 matches:
#                 match-regexp: "HELLO!HELLO!HELLO!HELLO!HELLO!"

mount:
  /home:
    exists: true
    opts:
      - rw
    source: /dev/mapper/fedora-home
    filesystem: xfs
    usage:
      lt: 95

package:
  httpd:
    installed: true
    versions:
      - "2.1"
    skip: false
# https://github.com/goss-org/goss/blob/master/README.md#manually-editing-goss-files    
  kernel:
    installed: true
    versions:
      and:
        - have-len: 3
        - not:
            contain-element: "4.1.0"
port:
  tcp:22:
    listening: true
    ip:
      - "1"
    skip: false

process:
  chrome:
    # required attributes
    running: true
    skip: false

service:
  sshd:
    enabled: true
    skip: false
    running: true

user:
    nfsbody:
      exists: true
      uid: 65534
      gid: 65534
      groups:
        - nfsnobody
      home: /var/lib/nfs
      shell: /sbin/nologin
      skip: false
    
    nobody:
      exists: true
      uid:
        lt: 500
      groups:
        consist-of: [nobody]
    
    sshd:
      title: UID must be between 50-100, GID doesn't matter. home is flexible
      meta:
        desc: Ensure sshd is enabled and running since it's needed for system management
        sev: 5
      exists: true
      uid:
        # Validate that UID is between 50 and 100
        and:
          gt: 50
          lt: 100
      home:
        # Home can be any of the following
        or:
          - /var/empty/sshd
          - /var/run/sshd

# https://github.com/goss-org/goss/blob/master/README.md#manually-editing-goss-files
            



