|
19 | 19 |
|
20 | 20 | apply plugin: 'elasticsearch.docs-test'
|
21 | 21 |
|
22 |
| -/* List of files that have snippets that require a gold or platinum licence |
23 |
| -and therefore cannot be tested yet... */ |
| 22 | +/* List of files that have snippets that will not work until platinum tests can occur ... */ |
24 | 23 | buildRestTests.expectedUnconvertedCandidates = [
|
25 | 24 | 'reference/ml/transforms.asciidoc',
|
| 25 | + 'reference/ml/apis/delete-calendar-event.asciidoc', |
| 26 | + 'reference/ml/apis/get-bucket.asciidoc', |
| 27 | + 'reference/ml/apis/get-category.asciidoc', |
| 28 | + 'reference/ml/apis/get-influencer.asciidoc', |
| 29 | + 'reference/ml/apis/get-job-stats.asciidoc', |
| 30 | + 'reference/ml/apis/get-overall-buckets.asciidoc', |
| 31 | + 'reference/ml/apis/get-record.asciidoc', |
| 32 | + 'reference/ml/apis/get-snapshot.asciidoc', |
| 33 | + 'reference/ml/apis/post-data.asciidoc', |
| 34 | + 'reference/ml/apis/revert-snapshot.asciidoc', |
| 35 | + 'reference/ml/apis/update-snapshot.asciidoc', |
26 | 36 | ]
|
27 | 37 |
|
28 | 38 | integTestCluster {
|
@@ -845,3 +855,224 @@ buildRestTests.setups['sensor_prefab_data'] = '''
|
845 | 855 | {"node.terms.value":"c","temperature.sum.value":202.0,"temperature.max.value":202.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":202.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":4.0,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516294800000,"voltage.avg._count":1.0,"_rollup.id":"sensor"}
|
846 | 856 |
|
847 | 857 | '''
|
| 858 | +buildRestTests.setups['sample_job'] = ''' |
| 859 | + - do: |
| 860 | + xpack.ml.put_job: |
| 861 | + job_id: "sample_job" |
| 862 | + body: > |
| 863 | + { |
| 864 | + "description" : "Very basic job", |
| 865 | + "analysis_config" : { |
| 866 | + "bucket_span":"10m", |
| 867 | + "detectors" :[ |
| 868 | + { |
| 869 | + "function": "count" |
| 870 | + } |
| 871 | + ]}, |
| 872 | + "data_description" : { |
| 873 | + "time_field":"timestamp", |
| 874 | + "time_format": "epoch_ms" |
| 875 | + } |
| 876 | + } |
| 877 | +''' |
| 878 | +buildRestTests.setups['farequote_index'] = ''' |
| 879 | + - do: |
| 880 | + indices.create: |
| 881 | + index: farequote |
| 882 | + body: |
| 883 | + settings: |
| 884 | + number_of_shards: 1 |
| 885 | + number_of_replicas: 0 |
| 886 | + mappings: |
| 887 | + metric: |
| 888 | + properties: |
| 889 | + time: |
| 890 | + type: date |
| 891 | + responsetime: |
| 892 | + type: float |
| 893 | + airline: |
| 894 | + type: keyword |
| 895 | + doc_count: |
| 896 | + type: integer |
| 897 | +''' |
| 898 | +buildRestTests.setups['farequote_data'] = buildRestTests.setups['farequote_index'] + ''' |
| 899 | + - do: |
| 900 | + bulk: |
| 901 | + index: farequote |
| 902 | + type: metric |
| 903 | + refresh: true |
| 904 | + body: | |
| 905 | + {"index": {"_id":"1"}} |
| 906 | + {"airline":"JZA","responsetime":990.4628,"time":"2016-02-07T00:00:00+0000", "doc_count": 5} |
| 907 | + {"index": {"_id":"2"}} |
| 908 | + {"airline":"JBU","responsetime":877.5927,"time":"2016-02-07T00:00:00+0000", "doc_count": 23} |
| 909 | + {"index": {"_id":"3"}} |
| 910 | + {"airline":"KLM","responsetime":1355.4812,"time":"2016-02-07T00:00:00+0000", "doc_count": 42} |
| 911 | +''' |
| 912 | +buildRestTests.setups['farequote_job'] = buildRestTests.setups['farequote_data'] + ''' |
| 913 | + - do: |
| 914 | + xpack.ml.put_job: |
| 915 | + job_id: "farequote" |
| 916 | + body: > |
| 917 | + { |
| 918 | + "analysis_config": { |
| 919 | + "bucket_span": "60m", |
| 920 | + "detectors": [{ |
| 921 | + "function": "mean", |
| 922 | + "field_name": "responsetime", |
| 923 | + "by_field_name": "airline" |
| 924 | + }], |
| 925 | + "summary_count_field_name": "doc_count" |
| 926 | + }, |
| 927 | + "data_description": { |
| 928 | + "time_field": "time" |
| 929 | + } |
| 930 | + } |
| 931 | +''' |
| 932 | +buildRestTests.setups['farequote_datafeed'] = buildRestTests.setups['farequote_job'] + ''' |
| 933 | + - do: |
| 934 | + xpack.ml.put_datafeed: |
| 935 | + datafeed_id: "datafeed-farequote" |
| 936 | + body: > |
| 937 | + { |
| 938 | + "job_id":"farequote", |
| 939 | + "indexes":"farequote" |
| 940 | + } |
| 941 | +''' |
| 942 | +buildRestTests.setups['server_metrics_index'] = ''' |
| 943 | + - do: |
| 944 | + indices.create: |
| 945 | + index: server-metrics |
| 946 | + body: |
| 947 | + settings: |
| 948 | + number_of_shards: 1 |
| 949 | + number_of_replicas: 0 |
| 950 | + mappings: |
| 951 | + metric: |
| 952 | + properties: |
| 953 | + timestamp: |
| 954 | + type: date |
| 955 | + total: |
| 956 | + type: long |
| 957 | +''' |
| 958 | +buildRestTests.setups['server_metrics_data'] = buildRestTests.setups['server_metrics_index'] + ''' |
| 959 | + - do: |
| 960 | + bulk: |
| 961 | + index: server-metrics |
| 962 | + type: metric |
| 963 | + refresh: true |
| 964 | + body: | |
| 965 | + {"index": {"_id":"1177"}} |
| 966 | + {"timestamp":"2017-03-23T13:00:00","total":40476} |
| 967 | + {"index": {"_id":"1178"}} |
| 968 | + {"timestamp":"2017-03-23T13:00:00","total":15287} |
| 969 | + {"index": {"_id":"1179"}} |
| 970 | + {"timestamp":"2017-03-23T13:00:00","total":-776} |
| 971 | + {"index": {"_id":"1180"}} |
| 972 | + {"timestamp":"2017-03-23T13:00:00","total":11366} |
| 973 | + {"index": {"_id":"1181"}} |
| 974 | + {"timestamp":"2017-03-23T13:00:00","total":3606} |
| 975 | + {"index": {"_id":"1182"}} |
| 976 | + {"timestamp":"2017-03-23T13:00:00","total":19006} |
| 977 | + {"index": {"_id":"1183"}} |
| 978 | + {"timestamp":"2017-03-23T13:00:00","total":38613} |
| 979 | + {"index": {"_id":"1184"}} |
| 980 | + {"timestamp":"2017-03-23T13:00:00","total":19516} |
| 981 | + {"index": {"_id":"1185"}} |
| 982 | + {"timestamp":"2017-03-23T13:00:00","total":-258} |
| 983 | + {"index": {"_id":"1186"}} |
| 984 | + {"timestamp":"2017-03-23T13:00:00","total":9551} |
| 985 | + {"index": {"_id":"1187"}} |
| 986 | + {"timestamp":"2017-03-23T13:00:00","total":11217} |
| 987 | + {"index": {"_id":"1188"}} |
| 988 | + {"timestamp":"2017-03-23T13:00:00","total":22557} |
| 989 | + {"index": {"_id":"1189"}} |
| 990 | + {"timestamp":"2017-03-23T13:00:00","total":40508} |
| 991 | + {"index": {"_id":"1190"}} |
| 992 | + {"timestamp":"2017-03-23T13:00:00","total":11887} |
| 993 | + {"index": {"_id":"1191"}} |
| 994 | + {"timestamp":"2017-03-23T13:00:00","total":31659} |
| 995 | +''' |
| 996 | +buildRestTests.setups['server_metrics_job'] = buildRestTests.setups['server_metrics_data'] + ''' |
| 997 | + - do: |
| 998 | + xpack.ml.put_job: |
| 999 | + job_id: "total-requests" |
| 1000 | + body: > |
| 1001 | + { |
| 1002 | + "description" : "Total sum of requests", |
| 1003 | + "analysis_config" : { |
| 1004 | + "bucket_span":"10m", |
| 1005 | + "detectors" :[ |
| 1006 | + { |
| 1007 | + "detector_description": "Sum of total", |
| 1008 | + "function": "sum", |
| 1009 | + "field_name": "total" |
| 1010 | + } |
| 1011 | + ]}, |
| 1012 | + "data_description" : { |
| 1013 | + "time_field":"timestamp", |
| 1014 | + "time_format": "epoch_ms" |
| 1015 | + } |
| 1016 | + } |
| 1017 | +''' |
| 1018 | +buildRestTests.setups['server_metrics_datafeed'] = buildRestTests.setups['server_metrics_job'] + ''' |
| 1019 | + - do: |
| 1020 | + xpack.ml.put_datafeed: |
| 1021 | + datafeed_id: "datafeed-total-requests" |
| 1022 | + body: > |
| 1023 | + { |
| 1024 | + "job_id":"total-requests", |
| 1025 | + "indexes":"server-metrics" |
| 1026 | + } |
| 1027 | +''' |
| 1028 | +buildRestTests.setups['server_metrics_openjob'] = buildRestTests.setups['server_metrics_datafeed'] + ''' |
| 1029 | + - do: |
| 1030 | + xpack.ml.open_job: |
| 1031 | + job_id: "total-requests" |
| 1032 | +''' |
| 1033 | +buildRestTests.setups['server_metrics_startdf'] = buildRestTests.setups['server_metrics_openjob'] + ''' |
| 1034 | + - do: |
| 1035 | + xpack.ml.start_datafeed: |
| 1036 | + datafeed_id: "datafeed-total-requests" |
| 1037 | +''' |
| 1038 | +buildRestTests.setups['calendar_outages'] = ''' |
| 1039 | + - do: |
| 1040 | + xpack.ml.put_calendar: |
| 1041 | + calendar_id: "planned-outages" |
| 1042 | +''' |
| 1043 | +buildRestTests.setups['calendar_outages_addevent'] = buildRestTests.setups['calendar_outages'] + ''' |
| 1044 | + - do: |
| 1045 | + xpack.ml.post_calendar_events: |
| 1046 | + calendar_id: "planned-outages" |
| 1047 | + body: > |
| 1048 | + { "description": "event 1", "start_time": "2017-12-01T00:00:00Z", "end_time": "2017-12-02T00:00:00Z", "calendar_id": "planned-outages" } |
| 1049 | +
|
| 1050 | +
|
| 1051 | +''' |
| 1052 | +buildRestTests.setups['calendar_outages_openjob'] = buildRestTests.setups['server_metrics_openjob'] + ''' |
| 1053 | + - do: |
| 1054 | + xpack.ml.put_calendar: |
| 1055 | + calendar_id: "planned-outages" |
| 1056 | +''' |
| 1057 | +buildRestTests.setups['calendar_outages_addjob'] = buildRestTests.setups['server_metrics_openjob'] + ''' |
| 1058 | + - do: |
| 1059 | + xpack.ml.put_calendar: |
| 1060 | + calendar_id: "planned-outages" |
| 1061 | + body: > |
| 1062 | + { |
| 1063 | + "job_ids": ["total-requests"] |
| 1064 | + } |
| 1065 | +''' |
| 1066 | +buildRestTests.setups['calendar_outages_addevent'] = buildRestTests.setups['calendar_outages_addjob'] + ''' |
| 1067 | + - do: |
| 1068 | + xpack.ml.post_calendar_events: |
| 1069 | + calendar_id: "planned-outages" |
| 1070 | + body: > |
| 1071 | + { "events" : [ |
| 1072 | + { "description": "event 1", "start_time": "1513641600000", "end_time": "1513728000000"}, |
| 1073 | + { "description": "event 2", "start_time": "1513814400000", "end_time": "1513900800000"}, |
| 1074 | + { "description": "event 3", "start_time": "1514160000000", "end_time": "1514246400000"} |
| 1075 | + ]} |
| 1076 | +''' |
| 1077 | + |
| 1078 | + |
0 commit comments