---
- test: Bad spec item (bad-path)
  steps:
    -   in: exit 1
        exit: 1

- test: No binaris.yml in directory (bad-path)
  setup:
    - mkdir -p /home/dockeruser/test/trollycopter
  steps:
    -   in: bn deploy -p /home/dockeruser/test/trollycopter icydiceymolecule
        err: "ENOENT: no such file or directory, open '/home/dockeruser/test/trollycopter/binaris.yml'"
        exit: 1

- test: No matching function (bad-path)
  steps:
    -   in: bn create node8 unrelatedname
    -   in: bn deploy grouchybear
        err: "binaris.yml is missing function 'grouchybear'"
        exit: 1

- test: No Binaris backend (bad-path)
  setup:
    - export BINARIS_DEPLOY_ENDPOINT=fake.binaris.invalid.
  steps:
    -   in: bn create node8 naughtyvegetable
    -   in: bn deploy naughtyvegetable
        err: "Error: getaddrinfo ENOTFOUND fake.binaris.invalid. fake.binaris.invalid.:443"
        exit: 1
    -   in: bn remove naughtyvegetable
        err: "Error: getaddrinfo ENOTFOUND fake.binaris.invalid. fake.binaris.invalid.:443"
        exit: 1

- test: Corrupt binaris conf file (bad-path)
  setup:
    - echo 'INVALIDCONF' | tee /home/dockeruser/.binaris.yml > /dev/null
    - unset BINARIS_API_KEY
  steps:
    -   in: bn create node8 didacticbrothers
    -   in: bn deploy didacticbrothers
        err: Invalid Binaris conf file (missing apiKey) /home/dockeruser/.binaris.yml
        exit: 1

- test: create function with template name
  steps:
    -   in: bn create node8 hello -p /home/dockeruser/test/hello
        out: |-
            Created function hello in /home/dockeruser/test/hello
              (use "bn deploy -p /home/dockeruser/test/hello hello" to deploy the function)

- test: Missing info in binaris.yml (bad-path)
  steps:
    -   in: bn create node8 missfield
    -   in: sed -i '6d' binaris.yml
    -   in: bn deploy missfield
        err: "binaris.yml is missing field <runtime>"
        exit: 1
