setup:
  - skip:
      features: headers
  - do:
      headers:
        Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
      ml.put_job:
        job_id: revert-model-snapshot
        body:  >
          {
            "job_id":"revert-model-snapshot",
            "description":"Analysis of response time by airline",
            "analysis_config" : {
                "bucket_span": "1h",
                "detectors" :[{"function":"metric","field_name":"responsetime","by_field_name":"airline"}]
            },
            "data_description" : {
                "time_field":"time",
                "time_format":"yyyy-MM-dd HH:mm:ssX"
            }
          }
---
"Test revert model with invalid snapshotId":
  - do:
      catch: /resource_not_found_exception/
      ml.revert_model_snapshot:
        job_id: "revert-model-snapshot"
        snapshot_id: "not_exist"

---
"Test with unknown job id":
  - do:
      catch: missing
      ml.revert_model_snapshot:
        job_id: "non-existent-job"
        snapshot_id: "second"
