/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0; you may not use this file except in compliance with the Elastic License
 * 2.0.
 */

apply plugin: 'elasticsearch.legacy-yaml-rest-test'

dependencies {
  yamlRestTestImplementation project(':x-pack:plugin:core')
  yamlRestTestImplementation project(path: xpackModule('watcher'))
}

restResources {
  restApi {
    include 'watcher'
  }
}

String slackUrl = System.getenv('slack_url')

if (!slackUrl) {
  tasks.named("yamlRestTest").configure { enabled = false }
} else {
  testClusters.matching { it.name == "yamlRestTest" }.configureEach {
    testDistribution = 'DEFAULT'
    setting 'xpack.security.enabled', 'false'
    setting 'xpack.ml.enabled', 'false'
    setting 'xpack.license.self_generated.type', 'trial'
    setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'
    keystore 'xpack.notification.slack.account.test_account.secure_url', slackUrl
  }
}

if (buildParams.inFipsJvm){
  // Test clusters run with security disabled
  tasks.named("yamlRestTest").configure{enabled = false }
}
