-
Notifications
You must be signed in to change notification settings - Fork 4
/
kip500-test.sh
executable file
·113 lines (101 loc) · 2.46 KB
/
kip500-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env bash
ALL=0
DRY_RUN=0
die() {
echo $@
exit 1
}
gradle_base_command() {
echo "./gradlew "
}
gradle_submodule_arguments() {
local SUBMODULE=$1
echo ":${SUBMODULE}:test \
-x :${SUBMODULE}:checkstyleMain \
-x :${SUBMODULE}:checkstyleTest \
-x :${SUBMODULE}:spotbugsMain \
-x :${SUBMODULE}:spotbugsTest"
}
gradle_test_arguments() {
RESULT=""
for ARGUMENT in "$@"; do
RESULT+=" --tests ${ARGUMENT}"
done
echo $RESULT
}
run_gradle_for_test_submodules() {
local SUBMODULES=$@
CMD=$(gradle_base_command)
for SUBMODULE in $SUBMODULES; do
CMD+=" $(gradle_submodule_arguments $SUBMODULE)"
done
echo $CMD
if [[ $DRY_RUN == 0 ]]; then
$CMD
fi
}
run_specific_tests() {
local SUBMODULE=$1
shift
CMD=$(gradle_base_command)
CMD+=" $(gradle_submodule_arguments $SUBMODULE)"
for TEST_NAME in "$@"; do
CMD+=" $(gradle_test_arguments $TEST_NAME)"
done
echo $CMD
if [[ $DRY_RUN == 0 ]]; then
$CMD
fi
}
usage() {
cat <<EOF
kip500-test.sh: runs kip-500 tests.
-a: run all tests, including core tests.
-d: dry-run: don't run anything, just echo.
-h: This help message.
EOF
exit 0
}
while getopts "adh" flag; do
case $flag in
a) ALL=1;;
d) DRY_RUN=1;;
h) usage;;
*) die "Invalid flag. -h for help.";;
esac
done
set -e
run_gradle_for_test_submodules \
server-common \
shell \
metadata
if [[ $ALL == 1 ]]; then
run_gradle_for_test_submodules raft
run_specific_tests core \
AlterIsrManagerTest \
BrokerLifecycleManagerTest \
BrokerMetadataCheckpointTest \
BrokerMetadataListenerTest \
BrokerMetadataSnapshotterTest \
ClientQuotasRequestTest \
ClusterToolTest \
ControllerApisTest \
ControllerConfigurationValidatorTest \
DynamicBrokerReconfigurationTest \
DynamicConfigChangeTest \
InterBrokerSendThreadTest \
KRaftClusterTest \
KafkaMetadataLogTest \
KafkaRaftServerTest \
KafkaServerTest \
LocalConfigRepositoryTest \
MetadataBrokersTest \
MetadataCacheTest \
MetadataPartitionsTest \
MetadataRequestWithForwardingTest \
MetadataVersionIntegrationTest \
ProducerIdsIntegrationTest \
RaftClusterSnapshotTest \
RaftClusterTest \
StorageToolTest
fi