---
setup:

  - do:
      snapshot.create_repository:
        repository: test_repo_status_1
        body:
          type: fs
          settings:
            location: "test_repo_status_1_loc"

---
"Get snapshot status":

  - do:
      indices.create:
        index: test_index
        body:
          settings:
            number_of_shards:   1
            number_of_replicas: 0

  - do:
      snapshot.create:
        repository: test_repo_status_1
        snapshot: test_snapshot
        wait_for_completion: true

  - do:
      snapshot.status:
        repository: test_repo_status_1
        snapshot: test_snapshot

  - is_true: snapshots

---
"Get missing snapshot status throws an exception":

  - do:
      catch: /snapshot_missing_exception.+ is missing/
      snapshot.status:
        repository: test_repo_status_1
        snapshot: test_nonexistent_snapshot

---
"Get missing snapshot status succeeds when ignoreUnavailable is true":

  - do:
      snapshot.status:
        repository: test_repo_status_1
        snapshot: test_nonexistent_snapshot
        ignore_unavailable: true

  - is_true: snapshots
