-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tests] Mutualize fixtures code in BaseHttpFixture #31210
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,10 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) { | |
baseDir, | ||
unzip.temporaryDir, | ||
version == '090' | ||
waitCondition = { fixture, ant -> | ||
return fixture.portsFile.exists() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this now needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The OldElasticsearch fixture used in the reindex module tests starts an Elasticsearch instance and waits for its HTTP service to be started, then it writes the HTTP port to the Before this change, the fixture here used the default AntFixture's waitCondition which is to execute a HTTP GET request on the address indicated in the fixture's I'll revert this change in this PR and address all changes related to |
||
|
||
} | ||
} | ||
integTest.dependsOn fixture | ||
integTestRunner { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.elasticsearch.example.resthandler; | ||
|
||
import basic.BaseHttpFixture; | ||
|
||
import java.io.IOException; | ||
import java.util.Objects; | ||
|
||
import static java.nio.charset.StandardCharsets.UTF_8; | ||
|
||
public class ExampleFixture extends BaseHttpFixture { | ||
|
||
private final String message; | ||
|
||
private ExampleFixture(final String workingDir, final String message) { | ||
super(workingDir); | ||
this.message = Objects.requireNonNull(message); | ||
} | ||
|
||
@Override | ||
protected Response handle(final Request request) throws IOException { | ||
if ("GET".equals(request.getMethod()) && "/".equals(request.getPath())) { | ||
return new Response(200, TEXT_PLAIN_CONTENT_TYPE, message.getBytes(UTF_8)); | ||
} | ||
return null; | ||
} | ||
|
||
public static void main(final String[] args) throws Exception { | ||
if (args == null || args.length != 2) { | ||
throw new IllegalArgumentException("ExampleFixture <working directory> <echo message>"); | ||
} | ||
|
||
final ExampleFixture fixture = new ExampleFixture(args[0], args[1]); | ||
fixture.listen(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, good catch. Can you create a separate PR for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created #31272