Some improvements in the pipeline and integration tests (#1357)
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
# build a lightweight project so that dependencies for the
|
||||
# maven-surefire-plugin are downloaded and thus cached also
|
||||
|
||||
name: build fabric8 istio project
|
||||
description: build fabric8 istio projects
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: build fabric8 istio project
|
||||
shell: bash
|
||||
run: |
|
||||
cd spring-cloud-kubernetes-fabric8-istio
|
||||
.././mvnw -s ../.settings.xml clean install -U
|
||||
cd ..
|
||||
@@ -12,6 +12,10 @@ runs:
|
||||
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=error \
|
||||
-T 1C > /tmp/tests.txt
|
||||
|
||||
- name: show result
|
||||
shell: bash
|
||||
run: cat /tmp/tests.txt
|
||||
|
||||
- name: upload test
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
||||
3
.github/workflows/maven.yaml
vendored
3
.github/workflows/maven.yaml
vendored
@@ -31,9 +31,6 @@ jobs:
|
||||
- name: cache local maven repository
|
||||
uses: ./.github/workflows/composites/cache
|
||||
|
||||
- name: build fabric8 istio
|
||||
uses: ./.github/workflows/composites/fabric8-istio
|
||||
|
||||
- name: maven build with dry-run for tests
|
||||
uses: ./.github/workflows/composites/maven-build-with-dry-run-for-tests
|
||||
|
||||
|
||||
@@ -20,10 +20,16 @@ spec:
|
||||
httpGet:
|
||||
port: 8080
|
||||
path: /actuator/health/readiness
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 2
|
||||
failureThreshold: 3
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
port: 8080
|
||||
path: /actuator/health/liveness
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 2
|
||||
failureThreshold: 3
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ class KubernetesClientDiscoveryClientIT {
|
||||
Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S);
|
||||
|
||||
util = new Util(K3S);
|
||||
Commons.systemPrune();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
|
||||
@@ -77,6 +77,7 @@ class KubernetesClientDiscoveryFilterIT {
|
||||
Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S);
|
||||
|
||||
util = new Util(K3S);
|
||||
Commons.systemPrune();
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
|
||||
@@ -72,6 +72,7 @@ class KubernetesClientDiscoveryHealthIT {
|
||||
Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S);
|
||||
|
||||
util = new Util(K3S);
|
||||
Commons.systemPrune();
|
||||
util.setUp(NAMESPACE);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ class KubernetesClientDiscoveryMultipleSelectiveNamespacesIT {
|
||||
Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S);
|
||||
|
||||
util = new Util(K3S);
|
||||
Commons.systemPrune();
|
||||
|
||||
util.createNamespace(NAMESPACE_A);
|
||||
util.createNamespace(NAMESPACE_B);
|
||||
|
||||
@@ -67,6 +67,7 @@ class KubernetesClientDiscoveryPodMetadataIT {
|
||||
Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S);
|
||||
|
||||
util = new Util(K3S);
|
||||
Commons.systemPrune();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
|
||||
@@ -74,6 +74,7 @@ class KubernetesClientDiscoverySingleSelectiveNamespaceIT {
|
||||
Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S);
|
||||
|
||||
util = new Util(K3S);
|
||||
Commons.systemPrune();
|
||||
|
||||
util.createNamespace(NAMESPACE_A);
|
||||
util.createNamespace(NAMESPACE_B);
|
||||
|
||||
@@ -20,9 +20,15 @@ spec:
|
||||
httpGet:
|
||||
port: 8080
|
||||
path: /discoveryclient-it/actuator/health/readiness
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 2
|
||||
failureThreshold: 3
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
port: 8080
|
||||
path: /discoveryclient-it/actuator/health/liveness
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 2
|
||||
failureThreshold: 3
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
@@ -162,6 +162,19 @@ public final class Commons {
|
||||
CONTAINER.execInContainer("crictl", "rmi", image);
|
||||
}
|
||||
|
||||
/**
|
||||
* equivalent of 'docker system prune', but for crictl.
|
||||
*/
|
||||
public static void systemPrune() {
|
||||
try {
|
||||
CONTAINER.execInContainer("sh", "-c",
|
||||
"crictl ps -a | grep -v Running | awk '{print $1}' | xargs crictl rm && crictl rmi --prune");
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* validates that the provided image does exist in the local docker registry.
|
||||
*/
|
||||
|
||||
@@ -138,6 +138,7 @@ public final class Util {
|
||||
e.printStackTrace();
|
||||
LOG.info("events : " + events());
|
||||
LOG.info("describe deployment : " + describeDeployment(deployment));
|
||||
LOG.info("node events : " + nodeEvents());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
@@ -549,7 +550,7 @@ public final class Util {
|
||||
}
|
||||
|
||||
private void waitForDeploymentPodsToBeDeleted(Map<String, String> labels, String namespace) {
|
||||
await().timeout(Duration.ofSeconds(90)).until(() -> {
|
||||
await().timeout(Duration.ofSeconds(180)).until(() -> {
|
||||
try {
|
||||
int currentNumberOfPods = coreV1Api.listNamespacedPod(namespace, null, null, null, null,
|
||||
labelSelector(labels), null, null, null, null, null).getItems().size();
|
||||
@@ -620,6 +621,18 @@ public final class Util {
|
||||
}
|
||||
}
|
||||
|
||||
private String nodeEvents() {
|
||||
try {
|
||||
String nodeName = container.execInContainer("sh", "-c", "kubectl get nodes --no-headers | awk '{print $1}'")
|
||||
.getStdout();
|
||||
LOG.info("nodeName : " + nodeName);
|
||||
return container.execInContainer("sh", "-c", "kubectl describe node " + nodeName).getStdout();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private String describeDeployment(V1Deployment deployment) {
|
||||
try {
|
||||
return container
|
||||
|
||||
Reference in New Issue
Block a user