@@ -111,33 +111,19 @@ public void initAndResetContext() throws Exception {
111
111
if (restTestExecutionContext == null ) {
112
112
assert adminExecutionContext == null ;
113
113
assert blacklistPathMatchers == null ;
114
- ClientYamlSuiteRestSpec restSpec = ClientYamlSuiteRestSpec .load (SPEC_PATH );
114
+ final ClientYamlSuiteRestSpec restSpec = ClientYamlSuiteRestSpec .load (SPEC_PATH );
115
115
validateSpec (restSpec );
116
- List <HttpHost > hosts = getClusterHosts ();
117
- RestClient restClient = client ();
118
- Version infoVersion = readVersionsFromInfo (restClient , hosts .size ());
119
- Version esVersion ;
120
- try {
121
- Tuple <Version , Version > versionVersionTuple = readVersionsFromCatNodes (restClient );
122
- esVersion = versionVersionTuple .v1 ();
123
- Version masterVersion = versionVersionTuple .v2 ();
124
- logger .info ("initializing yaml client, minimum es version: [{}] master version: [{}] hosts: {}" ,
125
- esVersion , masterVersion , hosts );
126
- } catch (ResponseException ex ) {
127
- if (ex .getResponse ().getStatusLine ().getStatusCode () == 403 ) {
128
- logger .warn ("Fallback to simple info '/' request, _cat/nodes is not authorized" );
129
- esVersion = infoVersion ;
130
- logger .info ("initializing yaml client, minimum es version: [{}] hosts: {}" , esVersion , hosts );
131
- } else {
132
- throw ex ;
133
- }
134
- }
135
- ClientYamlTestClient clientYamlTestClient = initClientYamlTestClient (restSpec , restClient , hosts , esVersion );
116
+ final List <HttpHost > hosts = getClusterHosts ();
117
+ Tuple <Version , Version > versionVersionTuple = readVersionsFromCatNodes (adminClient ());
118
+ final Version esVersion = versionVersionTuple .v1 ();
119
+ final Version masterVersion = versionVersionTuple .v2 ();
120
+ logger .info ("initializing client, minimum es version [{}], master version, [{}], hosts {}" , esVersion , masterVersion , hosts );
121
+ final ClientYamlTestClient clientYamlTestClient = initClientYamlTestClient (restSpec , client (), hosts , esVersion , masterVersion );
136
122
restTestExecutionContext = new ClientYamlTestExecutionContext (clientYamlTestClient , randomizeContentType ());
137
123
adminExecutionContext = new ClientYamlTestExecutionContext (clientYamlTestClient , false );
138
- String [] blacklist = resolvePathsProperty (REST_TESTS_BLACKLIST , null );
124
+ final String [] blacklist = resolvePathsProperty (REST_TESTS_BLACKLIST , null );
139
125
blacklistPathMatchers = new ArrayList <>();
140
- for (String entry : blacklist ) {
126
+ for (final String entry : blacklist ) {
141
127
blacklistPathMatchers .add (new BlacklistedPathPatternMatcher (entry ));
142
128
}
143
129
}
@@ -151,9 +137,13 @@ public void initAndResetContext() throws Exception {
151
137
restTestExecutionContext .clear ();
152
138
}
153
139
154
- protected ClientYamlTestClient initClientYamlTestClient (ClientYamlSuiteRestSpec restSpec , RestClient restClient ,
155
- List <HttpHost > hosts , Version esVersion ) throws IOException {
156
- return new ClientYamlTestClient (restSpec , restClient , hosts , esVersion );
140
+ protected ClientYamlTestClient initClientYamlTestClient (
141
+ final ClientYamlSuiteRestSpec restSpec ,
142
+ final RestClient restClient ,
143
+ final List <HttpHost > hosts ,
144
+ final Version esVersion ,
145
+ final Version masterVersion ) throws IOException {
146
+ return new ClientYamlTestClient (restSpec , restClient , hosts , esVersion , masterVersion );
157
147
}
158
148
159
149
/**
0 commit comments