43
43
import static org .hamcrest .Matchers .containsInAnyOrder ;
44
44
import static org .hamcrest .Matchers .equalTo ;
45
45
import static org .hamcrest .Matchers .everyItem ;
46
+ import static org .hamcrest .Matchers .greaterThan ;
46
47
import static org .hamcrest .Matchers .is ;
47
48
48
49
@ ESIntegTestCase .ClusterScope (scope = ESIntegTestCase .Scope .TEST )
@@ -65,6 +66,7 @@ public void testRolloverOnEmptyIndex() throws Exception {
65
66
final ClusterState state = client ().admin ().cluster ().prepareState ().get ().getState ();
66
67
final IndexMetaData oldIndex = state .metaData ().index ("test_index-1" );
67
68
assertFalse (oldIndex .getAliases ().containsKey ("test_alias" ));
69
+ assertThat (IndexMetaData .ROLLOVER_CREATION_DATE_SETTING .get (oldIndex .getSettings ()), greaterThan (0L ));
68
70
final IndexMetaData newIndex = state .metaData ().index ("test_index-000002" );
69
71
assertTrue (newIndex .getAliases ().containsKey ("test_alias" ));
70
72
}
@@ -81,6 +83,7 @@ public void testRollover() throws Exception {
81
83
assertThat (response .getConditionStatus ().size (), equalTo (0 ));
82
84
final ClusterState state = client ().admin ().cluster ().prepareState ().get ().getState ();
83
85
final IndexMetaData oldIndex = state .metaData ().index ("test_index-2" );
86
+ assertThat (IndexMetaData .ROLLOVER_CREATION_DATE_SETTING .get (oldIndex .getSettings ()), greaterThan (0L ));
84
87
assertFalse (oldIndex .getAliases ().containsKey ("test_alias" ));
85
88
final IndexMetaData newIndex = state .metaData ().index ("test_index-000003" );
86
89
assertTrue (newIndex .getAliases ().containsKey ("test_alias" ));
@@ -104,6 +107,7 @@ public void testRolloverWithIndexSettings() throws Exception {
104
107
final ClusterState state = client ().admin ().cluster ().prepareState ().get ().getState ();
105
108
final IndexMetaData oldIndex = state .metaData ().index ("test_index-2" );
106
109
assertFalse (oldIndex .getAliases ().containsKey ("test_alias" ));
110
+ assertThat (IndexMetaData .ROLLOVER_CREATION_DATE_SETTING .get (oldIndex .getSettings ()), greaterThan (0L ));
107
111
final IndexMetaData newIndex = state .metaData ().index ("test_index-000003" );
108
112
assertThat (newIndex .getNumberOfShards (), equalTo (1 ));
109
113
assertThat (newIndex .getNumberOfReplicas (), equalTo (0 ));
@@ -123,6 +127,7 @@ public void testRolloverDryRun() throws Exception {
123
127
assertThat (response .getConditionStatus ().size (), equalTo (0 ));
124
128
final ClusterState state = client ().admin ().cluster ().prepareState ().get ().getState ();
125
129
final IndexMetaData oldIndex = state .metaData ().index ("test_index-1" );
130
+ assertThat (IndexMetaData .ROLLOVER_CREATION_DATE_SETTING .get (oldIndex .getSettings ()), equalTo (-1L ));
126
131
assertTrue (oldIndex .getAliases ().containsKey ("test_alias" ));
127
132
final IndexMetaData newIndex = state .metaData ().index ("test_index-000002" );
128
133
assertNull (newIndex );
@@ -149,6 +154,7 @@ public void testRolloverConditionsNotMet() throws Exception {
149
154
final ClusterState state = client ().admin ().cluster ().prepareState ().get ().getState ();
150
155
final IndexMetaData oldIndex = state .metaData ().index ("test_index-0" );
151
156
assertTrue (oldIndex .getAliases ().containsKey ("test_alias" ));
157
+ assertThat (IndexMetaData .ROLLOVER_CREATION_DATE_SETTING .get (oldIndex .getSettings ()), equalTo (-1L ));
152
158
final IndexMetaData newIndex = state .metaData ().index ("test_index-000001" );
153
159
assertNull (newIndex );
154
160
}
@@ -167,6 +173,7 @@ public void testRolloverWithNewIndexName() throws Exception {
167
173
final ClusterState state = client ().admin ().cluster ().prepareState ().get ().getState ();
168
174
final IndexMetaData oldIndex = state .metaData ().index ("test_index" );
169
175
assertFalse (oldIndex .getAliases ().containsKey ("test_alias" ));
176
+ assertThat (IndexMetaData .ROLLOVER_CREATION_DATE_SETTING .get (oldIndex .getSettings ()), greaterThan (0L ));
170
177
final IndexMetaData newIndex = state .metaData ().index ("test_new_index" );
171
178
assertTrue (newIndex .getAliases ().containsKey ("test_alias" ));
172
179
}
0 commit comments