Merge branch '3.0.x'

This commit is contained in:
Ryan Baxter
2023-07-05 09:31:15 -04:00
6 changed files with 26 additions and 69 deletions

View File

@@ -6,6 +6,11 @@ runs:
- name: build integration tests project without tests
shell: bash
run: |
cd spring-cloud-kubernetes-test-support
.././mvnw clean install -U
cd ..
cd spring-cloud-kubernetes-integration-tests
# build the images, but dont run the tests
.././mvnw -T 1C clean install -DskipTests

View File

@@ -1,18 +0,0 @@
name: run fabric8 istio integration test
description: run fabric8 istio integration test
runs:
using: "composite"
steps:
- name: run fabric8 istio integration test
shell: bash
run: |
cd spring-cloud-kubernetes-test-support
.././mvnw clean install
cd ..
docker load -i /tmp/docker/images/spring-cloud-kubernetes-fabric8-istio-it.tar
rm -fr /tmp/docker/images/spring-cloud-kubernetes-fabric8-istio-it.tar
cd spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-istio-it/
../.././mvnw clean install -Dskip.build.image=true
cd ../..

View File

@@ -11,6 +11,7 @@ jobs:
runs-on: ubuntu-latest
env:
TESTCONTAINERS_REUSE_ENABLE: false
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 30
steps:
- name: checkout project
@@ -61,44 +62,12 @@ jobs:
uses: ./.github/workflows/composites/upload-docker-images
if: env.BASE_BRANCH != '2.1.x'
# we need to run some test, so that K3s container is started and then all other instances will re-use this one.
# Otherwise, (since we use static ports) there might be two instances starting at the same time, and ports might conflict
# This does not run on '2.1.x' branch.
fabric8_istio_integration_test:
needs: build
runs-on: ubuntu-latest
steps:
- name: checkout project
uses: actions/checkout@v2
- name: set env variables
uses: ./.github/workflows/composites/env-variables
- name: setup project
uses: ./.github/workflows/composites/setup-jdk17
if: env.BASE_BRANCH == 'main' || env.BASE_BRANCH == '3.0.x'
- name: cache local maven repository
uses: ./.github/workflows/composites/cache
if: env.BASE_BRANCH != '2.1.x'
- name: download docker images
uses: ./.github/workflows/composites/download-docker-images
if: env.BASE_BRANCH != '2.1.x'
- name: echo saved images
uses: ./.github/workflows/composites/echo-saved-images
if: env.BASE_BRANCH != '2.1.x'
- name: integration test fabric8 istio
uses: ./.github/workflows/composites/fabric8-istio-integration-test
if: env.BASE_BRANCH != '2.1.x'
test:
needs: [ build, fabric8_istio_integration_test ]
needs: [ build ]
runs-on: ubuntu-latest
timeout-minutes: 60
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 30
strategy:
fail-fast: true

View File

@@ -16,7 +16,6 @@
package org.springframework.cloud.kubernetes.fabric8.istio;
import java.io.File;
import java.io.InputStream;
import java.time.Duration;
import java.util.List;
@@ -57,12 +56,6 @@ class Fabric8IstioIT {
private static final String ISTIO_PILOT = "istio/pilot";
private static final String ISTIO_VERSION = "1.16.0";
private static final String LOCAL_ISTIO_BIN_PATH = "../../istio-cli/istio-" + ISTIO_VERSION + "/bin";
private static final String CONTAINER_ISTIO_BIN_PATH = "/tmp/istio/istio-bin/bin/";
private static KubernetesClient client;
private static Util util;
@@ -71,26 +64,24 @@ class Fabric8IstioIT {
@BeforeAll
static void beforeAll() throws Exception {
// Path passed to K3S container must be absolute
String absolutePath = new File(LOCAL_ISTIO_BIN_PATH).getAbsolutePath();
K3S = Commons.container().withFileSystemBind(absolutePath, CONTAINER_ISTIO_BIN_PATH);
K3S = Commons.container();
K3S.start();
util = new Util(K3S);
client = util.client();
Commons.validateImage(IMAGE_NAME, K3S);
Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S);
Commons.pullImage(ISTIO_PROXY, ISTIO_VERSION, K3S);
Commons.loadImage(ISTIO_PROXY, ISTIO_VERSION, "istioproxy", K3S);
Commons.pullImage(ISTIO_PILOT, ISTIO_VERSION, K3S);
Commons.loadImage(ISTIO_PILOT, ISTIO_VERSION, "istiopilot", K3S);
Commons.pullImage(ISTIO_PROXY, Commons.ISTIO_VERSION, K3S);
Commons.loadImage(ISTIO_PROXY, Commons.ISTIO_VERSION, "istioproxy", K3S);
Commons.pullImage(ISTIO_PILOT, Commons.ISTIO_VERSION, K3S);
Commons.loadImage(ISTIO_PILOT, Commons.ISTIO_VERSION, "istiopilot", K3S);
processExecResult(K3S.execInContainer("sh", "-c", "kubectl create namespace istio-test"));
processExecResult(
K3S.execInContainer("sh", "-c", "kubectl label namespace istio-test istio-injection=enabled"));
processExecResult(K3S.execInContainer("sh", "-c", CONTAINER_ISTIO_BIN_PATH + "istioctl"
+ " --kubeconfig=/etc/rancher/k3s/k3s.yaml install --set profile=minimal -y"));
processExecResult(K3S.execInContainer("sh", "-c",
"/tmp/istioctl" + " --kubeconfig=/etc/rancher/k3s/k3s.yaml install --set profile=minimal -y"));
util.setUpIstio(NAMESPACE);

View File

@@ -38,6 +38,7 @@ import org.junit.jupiter.api.Assertions;
import org.testcontainers.containers.Container;
import org.testcontainers.k3s.K3sContainer;
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.utility.MountableFile;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.ReflectionUtils;
@@ -56,6 +57,13 @@ public final class Commons {
private static final Log LOG = LogFactory.getLog(Commons.class);
/**
* istio version used in our integration tests.
*/
public static final String ISTIO_VERSION = "1.16.0";
private static final String LOCAL_ISTIO_BIN_PATH = "istio-cli/istio-" + ISTIO_VERSION + "/bin";
private Commons() {
throw new AssertionError("No instance provided");
}
@@ -85,6 +93,8 @@ public final class Commons {
private static final K3sContainer CONTAINER = new FixedPortsK3sContainer(DockerImageName.parse(Commons.RANCHER))
.configureFixedPorts(EXPOSED_PORTS).withFileSystemBind(TEMP_FOLDER, TEMP_FOLDER)
.withCopyFileToContainer(MountableFile.forClasspathResource(LOCAL_ISTIO_BIN_PATH + "/istioctl", 0744),
"/tmp/istioctl")
.withCommand(Commons.RANCHER_COMMAND).withReuse(true);
public static K3sContainer container() {