19
19
public class WorkloadManagementRestIT extends OpenSearchRestTestCase {
20
20
21
21
public void testCreate () throws Exception {
22
- Response response = performOperation ("PUT" , "_wlm/query_group " , getCreateJson ("analytics" , "enforced" , 0.4 , 0.2 ));
22
+ Response response = performOperation ("PUT" , "_wlm/workload_group " , getCreateJson ("analytics" , "enforced" , 0.4 , 0.2 ));
23
23
assertEquals (response .getStatusLine ().getStatusCode (), 200 );
24
- performOperation ("DELETE" , "_wlm/query_group /analytics" , null );
24
+ performOperation ("DELETE" , "_wlm/workload_group /analytics" , null );
25
25
}
26
26
27
27
public void testMultipleCreate () throws Exception {
28
- Response response = performOperation ("PUT" , "_wlm/query_group " , getCreateJson ("analytics2" , "enforced" , 0.4 , 0.2 ));
28
+ Response response = performOperation ("PUT" , "_wlm/workload_group " , getCreateJson ("analytics2" , "enforced" , 0.4 , 0.2 ));
29
29
assertEquals (response .getStatusLine ().getStatusCode (), 200 );
30
30
31
- Response response2 = performOperation ("PUT" , "_wlm/query_group " , getCreateJson ("users" , "soft" , 0.2 , 0.1 ));
31
+ Response response2 = performOperation ("PUT" , "_wlm/workload_group " , getCreateJson ("users" , "soft" , 0.2 , 0.1 ));
32
32
assertEquals (response2 .getStatusLine ().getStatusCode (), 200 );
33
33
34
34
assertThrows (
35
35
ResponseException .class ,
36
- () -> performOperation ("PUT" , "_wlm/query_group " , getCreateJson ("users2" , "soft" , 0.41 , 0.71 ))
36
+ () -> performOperation ("PUT" , "_wlm/workload_group " , getCreateJson ("users2" , "soft" , 0.41 , 0.71 ))
37
37
);
38
- performOperation ("DELETE" , "_wlm/query_group /analytics2" , null );
39
- performOperation ("DELETE" , "_wlm/query_group /users" , null );
38
+ performOperation ("DELETE" , "_wlm/workload_group /analytics2" , null );
39
+ performOperation ("DELETE" , "_wlm/workload_group /users" , null );
40
40
}
41
41
42
42
public void testGet () throws Exception {
43
- Response response = performOperation ("PUT" , "_wlm/query_group " , getCreateJson ("analytics3" , "enforced" , 0.4 , 0.2 ));
43
+ Response response = performOperation ("PUT" , "_wlm/workload_group " , getCreateJson ("analytics3" , "enforced" , 0.4 , 0.2 ));
44
44
assertEquals (response .getStatusLine ().getStatusCode (), 200 );
45
45
46
- Response response2 = performOperation ("GET" , "_wlm/query_group /analytics3" , null );
46
+ Response response2 = performOperation ("GET" , "_wlm/workload_group /analytics3" , null );
47
47
assertEquals (response2 .getStatusLine ().getStatusCode (), 200 );
48
48
String responseBody2 = EntityUtils .toString (response2 .getEntity ());
49
49
assertTrue (responseBody2 .contains ("\" name\" :\" analytics3\" " ));
50
50
assertTrue (responseBody2 .contains ("\" resiliency_mode\" :\" enforced\" " ));
51
51
assertTrue (responseBody2 .contains ("\" cpu\" :0.4" ));
52
52
assertTrue (responseBody2 .contains ("\" memory\" :0.2" ));
53
53
54
- assertThrows (ResponseException .class , () -> performOperation ("GET" , "_wlm/query_group /analytics97" , null ));
55
- performOperation ("DELETE" , "_wlm/query_group /analytics3" , null );
54
+ assertThrows (ResponseException .class , () -> performOperation ("GET" , "_wlm/workload_group /analytics97" , null ));
55
+ performOperation ("DELETE" , "_wlm/workload_group /analytics3" , null );
56
56
}
57
57
58
58
public void testDelete () throws Exception {
59
- Response response = performOperation ("PUT" , "_wlm/query_group " , getCreateJson ("analytics4" , "enforced" , 0.4 , 0.2 ));
59
+ Response response = performOperation ("PUT" , "_wlm/workload_group " , getCreateJson ("analytics4" , "enforced" , 0.4 , 0.2 ));
60
60
assertEquals (response .getStatusLine ().getStatusCode (), 200 );
61
61
62
- Response response2 = performOperation ("DELETE" , "_wlm/query_group /analytics4" , null );
62
+ Response response2 = performOperation ("DELETE" , "_wlm/workload_group /analytics4" , null );
63
63
assertEquals (response2 .getStatusLine ().getStatusCode (), 200 );
64
64
assertTrue (EntityUtils .toString (response2 .getEntity ()).contains ("\" acknowledged\" :true" ));
65
65
66
- assertThrows (ResponseException .class , () -> performOperation ("DELETE" , "_wlm/query_group /analytics99" , null ));
66
+ assertThrows (ResponseException .class , () -> performOperation ("DELETE" , "_wlm/workload_group /analytics99" , null ));
67
67
}
68
68
69
69
public void testUpdate () throws Exception {
70
- Response response = performOperation ("PUT" , "_wlm/query_group " , getCreateJson ("analytics5" , "enforced" , 0.4 , 0.2 ));
70
+ Response response = performOperation ("PUT" , "_wlm/workload_group " , getCreateJson ("analytics5" , "enforced" , 0.4 , 0.2 ));
71
71
assertEquals (response .getStatusLine ().getStatusCode (), 200 );
72
72
73
- Response response2 = performOperation ("PUT" , "_wlm/query_group /analytics5" , getUpdateJson ("monitor" , 0.41 , 0.21 ));
73
+ Response response2 = performOperation ("PUT" , "_wlm/workload_group /analytics5" , getUpdateJson ("monitor" , 0.41 , 0.21 ));
74
74
assertEquals (response2 .getStatusLine ().getStatusCode (), 200 );
75
75
String responseBody2 = EntityUtils .toString (response2 .getEntity ());
76
76
assertTrue (responseBody2 .contains ("\" name\" :\" analytics5\" " ));
@@ -84,22 +84,22 @@ public void testUpdate() throws Exception {
84
84
+ " \" memory\" : -0.1\n "
85
85
+ " }\n "
86
86
+ "}'" ;
87
- assertThrows (ResponseException .class , () -> performOperation ("PUT" , "_wlm/query_group /analytics5" , json ));
87
+ assertThrows (ResponseException .class , () -> performOperation ("PUT" , "_wlm/workload_group /analytics5" , json ));
88
88
assertThrows (
89
89
ResponseException .class ,
90
- () -> performOperation ("PUT" , "_wlm/query_group /analytics98" , getUpdateJson ("monitor" , 0.43 , 0.23 ))
90
+ () -> performOperation ("PUT" , "_wlm/workload_group /analytics98" , getUpdateJson ("monitor" , 0.43 , 0.23 ))
91
91
);
92
- performOperation ("DELETE" , "_wlm/query_group /analytics5" , null );
92
+ performOperation ("DELETE" , "_wlm/workload_group /analytics5" , null );
93
93
}
94
94
95
95
public void testCRUD () throws Exception {
96
- Response response = performOperation ("PUT" , "_wlm/query_group " , getCreateJson ("analytics6" , "enforced" , 0.4 , 0.2 ));
96
+ Response response = performOperation ("PUT" , "_wlm/workload_group " , getCreateJson ("analytics6" , "enforced" , 0.4 , 0.2 ));
97
97
assertEquals (response .getStatusLine ().getStatusCode (), 200 );
98
98
99
- Response response1 = performOperation ("PUT" , "_wlm/query_group /analytics6" , getUpdateJson ("monitor" , 0.41 , 0.21 ));
99
+ Response response1 = performOperation ("PUT" , "_wlm/workload_group /analytics6" , getUpdateJson ("monitor" , 0.41 , 0.21 ));
100
100
assertEquals (response1 .getStatusLine ().getStatusCode (), 200 );
101
101
102
- Response response2 = performOperation ("GET" , "_wlm/query_group /analytics6" , null );
102
+ Response response2 = performOperation ("GET" , "_wlm/workload_group /analytics6" , null );
103
103
assertEquals (response2 .getStatusLine ().getStatusCode (), 200 );
104
104
String responseBody2 = EntityUtils .toString (response2 .getEntity ());
105
105
assertTrue (responseBody2 .contains ("\" name\" :\" analytics6\" " ));
@@ -109,24 +109,24 @@ public void testCRUD() throws Exception {
109
109
110
110
assertThrows (
111
111
ResponseException .class ,
112
- () -> performOperation ("PUT" , "_wlm/query_group " , getCreateJson ("users3" , "monitor" , 0.6 , 0.8 ))
112
+ () -> performOperation ("PUT" , "_wlm/workload_group " , getCreateJson ("users3" , "monitor" , 0.6 , 0.8 ))
113
113
);
114
114
115
- Response response4 = performOperation ("PUT" , "_wlm/query_group " , getCreateJson ("users3" , "monitor" , 0.59 , 0.79 ));
115
+ Response response4 = performOperation ("PUT" , "_wlm/workload_group " , getCreateJson ("users3" , "monitor" , 0.59 , 0.79 ));
116
116
assertEquals (response4 .getStatusLine ().getStatusCode (), 200 );
117
117
118
- Response response5 = performOperation ("DELETE" , "_wlm/query_group /analytics6" , null );
118
+ Response response5 = performOperation ("DELETE" , "_wlm/workload_group /analytics6" , null );
119
119
assertEquals (response5 .getStatusLine ().getStatusCode (), 200 );
120
120
String responseBody5 = EntityUtils .toString (response5 .getEntity ());
121
121
assertTrue (responseBody5 .contains ("\" acknowledged\" :true" ));
122
122
123
- Response response6 = performOperation ("GET" , "_wlm/query_group " , null );
123
+ Response response6 = performOperation ("GET" , "_wlm/workload_group " , null );
124
124
assertEquals (response6 .getStatusLine ().getStatusCode (), 200 );
125
125
String responseBody6 = EntityUtils .toString (response6 .getEntity ());
126
- assertTrue (responseBody6 .contains ("\" query_groups \" " ));
126
+ assertTrue (responseBody6 .contains ("\" workload_groups \" " ));
127
127
assertTrue (responseBody6 .contains ("\" users3\" " ));
128
128
assertFalse (responseBody6 .contains ("\" analytics6\" " ));
129
- performOperation ("DELETE" , "_wlm/query_group /users3" , null );
129
+ performOperation ("DELETE" , "_wlm/workload_group /users3" , null );
130
130
}
131
131
132
132
static String getCreateJson (String name , String resiliencyMode , double cpu , double memory ) {
0 commit comments