From 6ad998edd964cc104ebdfaec3c731659cffbd8da Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Tue, 22 Oct 2024 13:19:55 +0200 Subject: [PATCH] Provided docker compose file for integration test services --- docker/docker-compose.yml | 32 +++++++++++++++++++ .../android/HttpAsyncClientIntegrationTest.kt | 6 +++- .../hc/android/HttpClientIntegrationTest.kt | 6 +++- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 docker/docker-compose.yml diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..dd1e897 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,32 @@ +# Copyright 2022, OK2 Consulting Ltd +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF 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. + +version: '3.5' + +services: + test-httpbin: + container_name: "test-httpbin" + image: "kennethreitz/httpbin:latest" + networks: + static-network: + ipv4_address: 172.20.0.2 + +networks: + static-network: + ipam: + config: + - subnet: 172.20.0.0/16 diff --git a/httpclient-android/src/androidTest/kotlin/com/ok2c/hc/android/HttpAsyncClientIntegrationTest.kt b/httpclient-android/src/androidTest/kotlin/com/ok2c/hc/android/HttpAsyncClientIntegrationTest.kt index 9d13e06..dacbb86 100644 --- a/httpclient-android/src/androidTest/kotlin/com/ok2c/hc/android/HttpAsyncClientIntegrationTest.kt +++ b/httpclient-android/src/androidTest/kotlin/com/ok2c/hc/android/HttpAsyncClientIntegrationTest.kt @@ -35,11 +35,15 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith +/** + * Make sure the integration test services are running + * by executing Docker Compose from /docker/docker-compose.yml + */ @RunWith(AndroidJUnit4::class) class HttpAsyncClientIntegrationTest { // HttpBin.org running in a docker container - val httpbin = HttpHost("172.19.0.2", 80) + val httpbin = HttpHost("172.20.0.2", 80) val client: CloseableHttpAsyncClient = HttpAsyncClientBuilder.create() .build(); diff --git a/httpclient-android/src/androidTest/kotlin/com/ok2c/hc/android/HttpClientIntegrationTest.kt b/httpclient-android/src/androidTest/kotlin/com/ok2c/hc/android/HttpClientIntegrationTest.kt index fb200ae..5b68b9f 100644 --- a/httpclient-android/src/androidTest/kotlin/com/ok2c/hc/android/HttpClientIntegrationTest.kt +++ b/httpclient-android/src/androidTest/kotlin/com/ok2c/hc/android/HttpClientIntegrationTest.kt @@ -31,11 +31,15 @@ import org.junit.After import org.junit.Test import org.junit.runner.RunWith +/** + * Make sure the integration test services are running + * by executing Docker Compose from /docker/docker-compose.yml + */ @RunWith(AndroidJUnit4::class) class HttpClientIntegrationTest { // HttpBin.org running in a docker container - val httpbin = HttpHost("172.19.0.2", 80) + val httpbin = HttpHost("172.20.0.2", 80) val client: CloseableHttpClient = HttpClientBuilder.create() .build();