Skip to content

Commit 078fba1

Browse files
authored
Improve finding tests (1) (#1420)
1 parent 87ffd67 commit 078fba1

File tree

18 files changed

+146
-45
lines changed

18 files changed

+146
-45
lines changed

.github/workflows/composites/maven-build-with-dry-run-for-tests/action.yaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,26 @@ description: maven-build-with-dry-run-for-tests
33
runs:
44
using: "composite"
55
steps:
6-
- name: maven-build-with-dry-run-for-tests
6+
7+
- name: run 'package' on the project
8+
shell: bash
9+
run: |
10+
./mvnw install -B \
11+
-Dskip.build.image=true \
12+
-DskipTests -DskipITs \
13+
-T 1C -q
14+
15+
- name: find all classpath entries
16+
shell: bash
17+
run: |
18+
./mvnw -q exec:exec -Dexec.classpathScope="test" -Dexec.executable="echo" -Dexec.args="%classpath" | tr : "\n" > /tmp/deps.txt
19+
20+
- name: find all tests
721
shell: bash
822
run: |
9-
# find all the tests that are supposed to be run, but don't actually run them.
10-
# this is achieved via: 'spring.cloud.k8s.skip.tests=true' in DisabledTestsCondition
11-
./mvnw test -B -Dskip.build.image=true -Dspring.cloud.k8s.skip.tests=true \
12-
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=error \
13-
-T 1C -q > /tmp/tests.txt
23+
cd spring-cloud-kubernetes-test-support
24+
.././mvnw -q exec:java -Dexec.mainClass="org.springframework.cloud.kubernetes.tests.discovery.TestsDiscovery" > /tmp/tests.txt
25+
cd ..
1426
1527
- name: show result
1628
if: always()

.github/workflows/composites/run-and-save-test-times-when-cache-present/action.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ runs:
88
uses: actions/cache/restore@v3
99
with:
1010
path: /tmp/sorted.txt
11-
key: ${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-${{ github.run_id }}
12-
restore-keys: ${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-
11+
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}
12+
restore-keys: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-
1313

1414
- name: show cached test times
1515
shell: bash
@@ -138,7 +138,7 @@ runs:
138138
# the previous cache will contain more tests then we currently have, so some
139139
# matrix instances will have no tests to run
140140
if [[ "$sum" -eq "0" ]]; then
141-
echo "no tests to run in current index, most probably this PR removed some tests"
141+
echo "no tests (with known times) to run in current index"
142142
tests_to_run_in_current_index='none'
143143
fi
144144

.github/workflows/composites/test-times/action.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ runs:
4747

4848
# save with the current run_id, but restore it without it. This means two things:
4949
# 1) if we re-run, cache will be available
50-
# 2) if there is a new run, we restore as '${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-'
50+
# 2) if there is a new run, we restore as '${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-'
5151
# meaning there could be many of them already present and this is not an exact match
5252
# github in this case will pick up the latest one, exactly what we want.
5353
- name: save test times in cache
5454
uses: actions/cache/save@v3
5555
if: env.BASE_BRANCH != '2.1.x'
5656
with:
5757
path: /tmp/sorted.txt
58-
key: ${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-${{ github.run_id }}
58+
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}

.github/workflows/maven.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ jobs:
6767
uses: actions/cache/restore@v3
6868
with:
6969
path: /tmp/sorted.txt
70-
key: ${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-${{ github.run_id }}
71-
restore-keys: ${{ runner.os }}-spring-cloud-kubernetes-existing-test-times-cache-
70+
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}
71+
restore-keys: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-
7272

7373
- name: check test times cache exists
7474
id: check_files

spring-cloud-kubernetes-client-discovery/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@
5050
<artifactId>spring-boot-starter-test</artifactId>
5151
<scope>test</scope>
5252
</dependency>
53-
<dependency>
54-
<groupId>org.junit.vintage</groupId>
55-
<artifactId>junit-vintage-engine</artifactId>
56-
<scope>test</scope>
57-
</dependency>
5853
<dependency>
5954
<groupId>org.springframework.boot</groupId>
6055
<artifactId>spring-boot-starter-web</artifactId>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
/**
4040
* @author wind57
4141
*/
42-
public class AbstractKubernetesProfileEnvironmentPostProcessorTest {
42+
public class KubernetesProfileEnvironmentPostProcessorTest {
4343

4444
private static final String FOUNT_IT = "foundIt";
4545

spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@
6666
<artifactId>spring-rabbit-test</artifactId>
6767
<scope>test</scope>
6868
</dependency>
69-
<dependency>
70-
<groupId>org.junit.vintage</groupId>
71-
<artifactId>junit-vintage-engine</artifactId>
72-
<scope>test</scope>
73-
</dependency>
7469
<dependency>
7570
<groupId>org.mockito</groupId>
7671
<artifactId>mockito-inline</artifactId>

spring-cloud-kubernetes-examples/kubernetes-leader-election-example/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@
4949
<artifactId>spring-boot-starter-test</artifactId>
5050
<scope>test</scope>
5151
</dependency>
52-
<dependency>
53-
<groupId>org.junit.vintage</groupId>
54-
<artifactId>junit-vintage-engine</artifactId>
55-
<scope>test</scope>
56-
</dependency>
5752
</dependencies>
5853

5954
<build>

spring-cloud-kubernetes-fabric8-config/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,6 @@
9797
<artifactId>spring-boot-starter-test</artifactId>
9898
<scope>test</scope>
9999
</dependency>
100-
<dependency>
101-
<groupId>org.junit.vintage</groupId>
102-
<artifactId>junit-vintage-engine</artifactId>
103-
<scope>test</scope>
104-
</dependency>
105100
<dependency>
106101
<groupId>org.springframework.cloud</groupId>
107102
<artifactId>spring-cloud-test-support</artifactId>

spring-cloud-kubernetes-fabric8-discovery/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@
6868
<scope>test</scope>
6969
</dependency>
7070

71-
<dependency>
72-
<groupId>org.junit.vintage</groupId>
73-
<artifactId>junit-vintage-engine</artifactId>
74-
<scope>test</scope>
75-
</dependency>
76-
7771
<dependency>
7872
<groupId>org.springframework.boot</groupId>
7973
<artifactId>spring-boot-starter-web</artifactId>

0 commit comments

Comments
 (0)