forked from apache/incubator-kie-kogito-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkogito-jobs-service.bats
104 lines (81 loc) · 3.5 KB
/
kogito-jobs-service.bats
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
#!/usr/bin/env bats
export KOGITO_HOME=/tmp/kogito
export HOME=$KOGITO_HOME
mkdir -p ${KOGITO_HOME}/launch
cp $BATS_TEST_DIRNAME/../../../kogito-infinispan-properties/added/kogito-infinispan-properties.sh ${KOGITO_HOME}/launch/
cp $BATS_TEST_DIRNAME/../../../kogito-logging/added/logging.sh ${KOGITO_HOME}/launch/
# imports
load $BATS_TEST_DIRNAME/../../added/launch/kogito-jobs-service.sh
load ${KOGITO_HOME}/launch/kogito-infinispan-properties.sh
teardown() {
rm -rf ${KOGITO_HOME}
}
@test "test enable persistence without set infinispan server list" {
export ENABLE_PERSISTENCE="true"
run configure_jobs_service
expected="INFINISPAN_CLIENT_SERVER_LIST env not found, please set it."
echo "Result is ${output} and expected is ${expected}"
[ "$status" -eq 1 ]
[ "${output}" = "${expected}" ]
}
@test "check if the backoffRetryMillis is correctly set" {
export BACKOFF_RETRY="2000"
configure_jobs_service
expected=" -Dkogito.jobs-service.backoffRetryMillis=2000"
echo "Result is ${KOGITO_JOBS_PROPS} and expected is ${expected}"
[ "${KOGITO_JOBS_PROPS}" = "${expected}" ]
}
@test "check if the maxIntervalLimitToRetryMillis is correctly set" {
export MAX_INTERVAL_LIMIT_RETRY="8000"
configure_jobs_service
expected=" -Dkogito.jobs-service.maxIntervalLimitToRetryMillis=8000"
echo "Result is ${KOGITO_JOBS_PROPS} and expected is ${expected}"
[ "${KOGITO_JOBS_PROPS}" = "${expected}" ]
}
@test "check if the maxIntervalLimitToRetryMillis and backoffRetryMillis are correctly set" {
export MAX_INTERVAL_LIMIT_RETRY="8000"
export BACKOFF_RETRY="2000"
configure_jobs_service
expected=" -Dkogito.jobs-service.backoffRetryMillis=2000 -Dkogito.jobs-service.maxIntervalLimitToRetryMillis=8000"
echo "Result is ${KOGITO_JOBS_PROPS} and expected is ${expected}"
[ "${KOGITO_JOBS_PROPS}" = "${expected}" ]
}
@test "check if the persistence is correctly configured with auth" {
export ENABLE_PERSISTENCE="true"
export INFINISPAN_CLIENT_SERVER_LIST="localhost:11222"
configure_jobs_service
result="${KOGITO_JOBS_PROPS}"
expected=" -Dkogito.jobs-service.persistence=infinispan -Dquarkus.infinispan-client.server-list=localhost:11222"
echo "Result is ${result} and expected is ${expected}"
[ "${result}" = "${expected}" ]
}
@test "check if the event is correctly set" {
export ENABLE_EVENTS="true"
export KAFKA_BOOTSTRAP_SERVERS="localhost:9999"
configure_jobs_service
result="${KOGITO_JOBS_PROPS}"
expected=" -Dquarkus.profile=events-support -Dmp.messaging.outgoing.kogito-job-service-job-status-events.bootstrap.servers=${KAFKA_BOOTSTRAP_SERVERS} -Devents-support.quarkus.kafka.bootstrap-servers=${KAFKA_BOOTSTRAP_SERVERS}"
echo "Result is ${result} and expected is ${expected}"
[ "${result}" = "${expected}" ]
}
@test "enable event without set kafka bootstrap server" {
export ENABLE_EVENTS="true"
run configure_jobs_service
echo "status is ${status}"
[ "$status" -eq 1 ]
}
@test "check if default http port is correctly set" {
configure_jobs_service_http_port
result="${KOGITO_JOBS_PROPS}"
expected=" -Dquarkus.http.port=8080"
echo "Result is ${result} and expected is ${expected}"
[ "${result}" = "${expected}" ]
}
@test "check if custom http port is correctly set" {
export HTTP_PORT="9090"
configure_jobs_service_http_port
result="${KOGITO_JOBS_PROPS}"
expected=" -Dquarkus.http.port=9090"
echo "Result is ${result} and expected is ${expected}"
[ "${result}" = "${expected}" ]
}