forked from opensearch-project/data-prepper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration test to verify that the core HTTP server starts. (opensea…
…rch-project#4255) Signed-off-by: David Venable <dlv@amazon.com>
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
...ore/src/integrationTest/java/org/opensearch/dataprepper/integration/CoreHttpServerIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.integration; | ||
|
||
import com.linecorp.armeria.client.WebClient; | ||
import com.linecorp.armeria.common.HttpMethod; | ||
import com.linecorp.armeria.common.HttpStatus; | ||
import com.linecorp.armeria.common.RequestHeaders; | ||
import com.linecorp.armeria.common.SessionProtocol; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.opensearch.dataprepper.plugins.InMemorySinkAccessor; | ||
import org.opensearch.dataprepper.plugins.InMemorySourceAccessor; | ||
import org.opensearch.dataprepper.test.framework.DataPrepperTestRunner; | ||
|
||
import static org.hamcrest.CoreMatchers.equalTo; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
class CoreHttpServerIT { | ||
private static final String PIPELINE_CONFIGURATION_UNDER_TEST = "minimal-pipeline.yaml"; | ||
private DataPrepperTestRunner dataPrepperTestRunner; | ||
private InMemorySourceAccessor inMemorySourceAccessor; | ||
private InMemorySinkAccessor inMemorySinkAccessor; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
dataPrepperTestRunner = DataPrepperTestRunner.builder() | ||
.withPipelinesDirectoryOrFile(PIPELINE_CONFIGURATION_UNDER_TEST) | ||
.build(); | ||
|
||
dataPrepperTestRunner.start(); | ||
inMemorySourceAccessor = dataPrepperTestRunner.getInMemorySourceAccessor(); | ||
inMemorySinkAccessor = dataPrepperTestRunner.getInMemorySinkAccessor(); | ||
} | ||
|
||
@AfterEach | ||
void tearDown() { | ||
dataPrepperTestRunner.stop(); | ||
} | ||
|
||
@Test | ||
void verify_list_api_is_running() { | ||
WebClient.of().execute(RequestHeaders.builder() | ||
.scheme(SessionProtocol.HTTP) | ||
.authority("127.0.0.1:4900") | ||
.method(HttpMethod.GET) | ||
.path("/list") | ||
.build()) | ||
.aggregate() | ||
.whenComplete((response, ex) -> { | ||
assertThat("Http Status", response.status(), equalTo(HttpStatus.OK)); | ||
}) | ||
.join(); | ||
} | ||
|
||
} |