@@ -29,160 +29,156 @@ describe("Split Index", () => {
29
29
cy . contains ( "Create index" ) ;
30
30
31
31
// type field name
32
- cy . get ( '[placeholder="Specify a name for the new index."]' ) . type ( sampleIndex ) . end ( ) ;
32
+ cy . get ( '[placeholder="Specify a name for the new index."]' ) . type ( sampleIndex ) ;
33
33
34
- cy . get ( '[data-test-subj="comboBoxSearchInput"]' ) . focus ( ) . type ( `${ sampleAlias } ` ) . end ( ) ;
34
+ cy . get ( '[data-test-subj="comboBoxSearchInput"]' ) . focus ( ) . type ( `${ sampleAlias } ` ) ;
35
35
36
36
// click create
37
- cy . get ( '[data-test-subj="createIndexCreateButton"]' ) . click ( { force : true } ) . end ( ) ;
37
+ cy . get ( '[data-test-subj="createIndexCreateButton"]' ) . click ( { force : true } ) ;
38
38
39
39
// The index should exist
40
- cy . get ( `#_selection_column_${ sampleIndex } -checkbox` ) . should ( "have.exist" ) . end ( ) ;
40
+ cy . get ( `#_selection_column_${ sampleIndex } -checkbox` ) . should ( "have.exist" ) ;
41
41
42
- cy . get ( `[data-test-subj="viewIndexDetailButton-${ sampleIndex } "]` ) . click ( ) . end ( ) ;
43
- cy . get ( "#indexDetailModalSettings" ) . click ( ) . end ( ) ;
42
+ cy . get ( `[data-test-subj="viewIndexDetailButton-${ sampleIndex } "]` ) . click ( ) ;
43
+ cy . get ( "#indexDetailModalSettings" , { timeout : 10000 } ) . click ( ) ;
44
44
45
45
cy . get ( '[data-test-subj="form-name-index.number_of_shards"] .euiText' ) . then ( ( $shardNumber ) => {
46
46
splitNumber = $shardNumber . attr ( "title" ) * 2 ;
47
47
} ) ;
48
48
49
- cy . get ( "#indexDetailModalAlias" ) . click ( ) . end ( ) ;
50
- cy . get ( `[title="${ sampleAlias } "]` ) . should ( "exist" ) . end ( ) ;
49
+ cy . get ( "#indexDetailModalAlias" ) . click ( ) ;
50
+ cy . get ( `[title="${ sampleAlias } "]` ) . should ( "exist" ) ;
51
51
52
52
// Update Index status to blocks write otherwise we can't apply split operation on it
53
53
cy . updateIndexSettings ( sampleIndex , {
54
54
"index.blocks.write" : "true" ,
55
- } ) . end ( ) ;
55
+ } ) ;
56
56
} ) ; // create index
57
57
58
58
it ( "Split successfully" , ( ) => {
59
59
const targetIndex = `${ sampleIndex } ` + "-target" ;
60
60
cy . get ( `[data-test-subj="checkboxSelectRow-${ sampleIndex } "]` )
61
61
. click ( )
62
- . end ( )
62
+
63
63
. get ( '[data-test-subj="moreAction"]' )
64
64
. click ( )
65
- . end ( )
65
+
66
66
. get ( '[data-test-subj="Split Action"]' )
67
67
. click ( )
68
- . end ( )
68
+
69
69
// Target Index Name is required
70
70
. get ( '[data-test-subj="targetIndexNameInput"]' )
71
71
. type ( `${ targetIndex } ` )
72
- . end ( )
72
+
73
73
// Number of shards after split is required
74
74
. get ( '[data-test-subj="numberOfShardsInput"]' )
75
75
. type ( `${ splitNumber } {downArrow}{enter}` )
76
- . end ( )
76
+
77
77
. get ( '[data-test-subj="numberOfReplicasInput"]' )
78
78
. clear ( )
79
79
. type ( `${ replicaNumber } ` )
80
- . end ( )
80
+
81
81
. get ( '[data-test-subj="splitButton"]' , { timeout : 8000 } )
82
- . click ( )
83
- . end ( ) ;
82
+ . click ( ) ;
84
83
85
- cy . get ( `[data-test-subj="viewIndexDetailButton-${ targetIndex } "]` ) . click ( ) . end ( ) ;
86
- cy . get ( "#indexDetailModalSettings" ) . click ( ) . end ( ) ;
87
- cy . get ( '[data-test-subj="form-name-index.number_of_shards"] .euiText' ) . should ( "have.text" , `${ splitNumber } ` ) . end ( ) ;
88
- cy . get ( '[data-test-subj="form-name-index.number_of_replicas"] input' ) . should ( "have.value" , `${ replicaNumber } ` ) . end ( ) ;
84
+ cy . get ( `[data-test-subj="viewIndexDetailButton-${ targetIndex } "]` ) . click ( ) ;
85
+ cy . get ( "#indexDetailModalSettings" , { timeout : 10000 } ) . click ( ) ;
86
+ cy . get ( '[data-test-subj="form-name-index.number_of_shards"] .euiText' ) . should ( "have.text" , `${ splitNumber } ` ) ;
87
+ cy . get ( '[data-test-subj="form-name-index.number_of_replicas"] input' ) . should ( "have.value" , `${ replicaNumber } ` ) ;
89
88
} ) ; // Split
90
89
91
90
it ( "Split successfully with advanced setting" , ( ) => {
92
91
const targetIndex = `${ sampleIndex } ` + "-setting" ;
93
92
cy . get ( `[data-test-subj="checkboxSelectRow-${ sampleIndex } "]` )
94
93
. click ( )
95
- . end ( )
94
+
96
95
. get ( '[data-test-subj="moreAction"]' )
97
96
. click ( )
98
- . end ( )
97
+
99
98
. get ( '[data-test-subj="Split Action"]' )
100
99
. click ( )
101
- . end ( )
100
+
102
101
. get ( "[data-test-subj=targetIndexNameInput]" )
103
102
. type ( `${ targetIndex } ` )
104
- . end ( )
103
+
105
104
// Instead of input shard number at shard field, another option is to populate it in advanced setting
106
105
. get ( '[aria-controls="accordionForCreateIndexSettings"]' )
107
106
. click ( )
108
- . end ( )
107
+
109
108
. get ( '[data-test-subj="codeEditorContainer"] textarea' )
110
109
. focus ( )
111
110
// Need to remove the default {} in advanced setting
112
111
. clear ( )
113
112
. type ( `{"index.number_of_shards": "${ splitNumber } ", "index.number_of_replicas": "${ replicaNumber } "}` , {
114
113
parseSpecialCharSequences : false ,
115
114
} )
116
- . end ( )
115
+
117
116
. get ( '[data-test-subj="splitButton"]' , { timeout : 8000 } )
118
- . click ( )
119
- . end ( ) ;
117
+ . click ( ) ;
120
118
121
- cy . get ( `[data-test-subj="viewIndexDetailButton-${ targetIndex } "]` ) . click ( ) . end ( ) ;
122
- cy . get ( "#indexDetailModalSettings" ) . click ( ) . end ( ) ;
123
- cy . get ( '[data-test-subj="form-name-index.number_of_shards"] .euiText' ) . should ( "have.text" , `${ splitNumber } ` ) . end ( ) ;
124
- cy . get ( '[data-test-subj="form-name-index.number_of_replicas"] input' ) . should ( "have.value" , `${ replicaNumber } ` ) . end ( ) ;
119
+ cy . get ( `[data-test-subj="viewIndexDetailButton-${ targetIndex } "]` ) . click ( ) ;
120
+ cy . get ( "#indexDetailModalSettings" , { timeout : 10000 } ) . click ( ) ;
121
+ cy . get ( '[data-test-subj="form-name-index.number_of_shards"] .euiText' ) . should ( "have.text" , `${ splitNumber } ` ) ;
122
+ cy . get ( '[data-test-subj="form-name-index.number_of_replicas"] input' ) . should ( "have.value" , `${ replicaNumber } ` ) ;
125
123
} ) ; // advanced setting
126
124
127
125
it ( "Split successfully with alias" , ( ) => {
128
126
const targetIndex = `${ sampleIndex } ` + "-alias" ;
129
127
const newAlias = "alias-new" ;
130
128
cy . get ( `[data-test-subj="checkboxSelectRow-${ sampleIndex } "]` )
131
129
. click ( )
132
- . end ( )
130
+
133
131
. get ( '[data-test-subj="moreAction"]' )
134
132
. click ( )
135
- . end ( )
133
+
136
134
. get ( '[data-test-subj="Split Action"]' )
137
135
. click ( )
138
- . end ( )
136
+
139
137
. get ( "[data-test-subj=targetIndexNameInput]" )
140
138
. type ( `${ targetIndex } ` )
141
- . end ( )
139
+
142
140
. get ( '[data-test-subj="numberOfShardsInput"]' )
143
141
. type ( `${ splitNumber } {downArrow}{enter}` )
144
- . end ( )
142
+
145
143
// Assign to an existing alias and a new alias
146
144
. get ( '[data-test-subj="form-name-aliases"] [data-test-subj="comboBoxSearchInput"]' )
147
145
. type ( `${ sampleAlias } {enter}${ newAlias } {enter}` )
148
- . end ( )
146
+
149
147
. get ( '[data-test-subj="splitButton"]' , { timeout : 8000 } )
150
- . click ( )
151
- . end ( ) ;
148
+ . click ( ) ;
152
149
153
- cy . get ( `[data-test-subj="viewIndexDetailButton-${ targetIndex } "]` ) . click ( ) . end ( ) ;
150
+ cy . get ( `[data-test-subj="viewIndexDetailButton-${ targetIndex } "]` ) . click ( ) ;
154
151
// Verify alias associated with the new index
155
- cy . get ( "#indexDetailModalAlias" ) . click ( ) . end ( ) ;
156
- cy . get ( `[title="${ newAlias } "]` ) . should ( "exist" ) . end ( ) ;
157
- cy . get ( `[title="${ sampleAlias } "]` ) . should ( "exist" ) . end ( ) ;
152
+ cy . get ( "#indexDetailModalAlias" ) . click ( ) ;
153
+ cy . get ( `[title="${ newAlias } "]` ) . should ( "exist" ) ;
154
+ cy . get ( `[title="${ sampleAlias } "]` ) . should ( "exist" ) ;
158
155
} ) ; // Create with alias
159
156
160
157
it ( "Update blocks write to true" , ( ) => {
161
158
// Set index to not blocks write
162
159
cy . updateIndexSettings ( sampleIndex , {
163
160
"index.blocks.write" : "false" ,
164
- } ) . end ( ) ;
161
+ } ) ;
165
162
cy . get ( `[data-test-subj="checkboxSelectRow-${ sampleIndex } "]` )
166
163
. click ( )
167
- . end ( )
164
+
168
165
. get ( '[data-test-subj="moreAction"]' )
169
166
. click ( )
170
- . end ( )
167
+
171
168
. get ( '[data-test-subj="Split Action"]' )
172
169
. click ( )
173
- . end ( )
170
+
174
171
// Index can't be split if it's blocks write status is not true
175
172
. get ( '[data-test-subj="splitButton"]' , { timeout : 8000 } )
176
173
. should ( "have.class" , "euiButton-isDisabled" )
177
- . end ( )
174
+
178
175
. wait ( 1000 )
179
176
// Set index to blocks write
180
177
. get ( '[data-test-subj="set-indexsetting-button"]' , { timeout : 8000 } )
181
178
. click ( )
182
- . end ( )
179
+
183
180
. get ( '[data-test-subj="splitButton"]' , { timeout : 8000 } )
184
- . click ( )
185
- . end ( ) ;
181
+ . click ( ) ;
186
182
} ) ; // Blocks write
187
183
} ) ;
188
184
} ) ;
0 commit comments