-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests.sh
executable file
·108 lines (89 loc) · 3.9 KB
/
run-tests.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
#!/usr/bin/env bash
mkdir -p tests/target
rm -fR tests/target/*
impl_name=${1}
if [[ -z ${impl_name} ]]; then
echo "Usage: $0 <impl_name>, where impl_name is one of: java, rust, go, java-native, kotlin-native"
exit 1
fi
if test -f test_times.txt;then
rm test_times.txt
fi
#set -x
timeDetais=-a
#timeDetais=-al
function runTemplates() {
echo "***************" >> test_times.txt
#asways run java as a 'benchmark'
export PATH=$(pwd)/hiera-ctp-java/target:$PATH
export SUFFIX="${ENVIRONMENT}_${CLUSTER_LOCATION}_${RELEASE}"
echo "JAVA Running $(which hiera-ctp)"
echo "JAVA_$SUFFIX" >> test_times.txt
command time $timeDetais -o test_times.txt consul-template --vault-renew-token=false --once -template "tests/in.tpl:tests/target/out-java_$SUFFIX.txt"
if [[ "rust" == ${impl_name} || "all" = ${impl_name} ]]; then
export PATH=$HOME/.cargo/bin:$PATH
echo "RUST Running $(which hiera-ctp)"
echo "RUST_$SUFFIX" >> test_times.txt
command time $timeDetais -o test_times.txt consul-template --vault-renew-token=false --once -template "tests/in.tpl:tests/target/out-rust_$SUFFIX.txt"
diff_result=$(diff tests/target/out-java_$SUFFIX.txt tests/target/out-rust_$SUFFIX.txt)
if [[ 0 -eq ${diff_result} ]]; then
echo "congratulations, rendered RUST templates are the same"
else
echo "ERROR: rendered by RUST templates are different"
exit 1
fi
fi
if [[ "go" == ${impl_name} || "all" = ${impl_name} ]]; then
export PATH=$HOME/go/bin:$PATH
echo "GO: Running $(which hiera-ctp)"
echo "GO_$SUFFIX" >> test_times.txt
command time $timeDetais -o test_times.txt consul-template --vault-renew-token=false --once -template "tests/in.tpl:tests/target/out-go_$SUFFIX.txt"
diff_result=$(diff tests/target/out-java_$SUFFIX.txt tests/target/out-go_$SUFFIX.txt)
if [[ 0 -eq ${diff_result} ]]; then
echo "congratulations, rendered GO templates are the same"
else
echo "ERROR: rendered by GO templates are different"
exit 1
fi
fi
if [[ "java-native" == ${impl_name} || "all" = ${impl_name} ]]; then
export PATH=$(pwd)/hiera-ctp-graal-native:$PATH
echo "GRAAL: Running $(which hiera-ctp)"
echo "JAVA-NATIVE_$SUFFIX" >> test_times.txt
command time $timeDetais -o test_times.txt consul-template --vault-renew-token=false --once -template "tests/in.tpl:tests/target/out-graal_$SUFFIX.txt"
diff_result=$(diff tests/target/out-java_$SUFFIX.txt tests/target/out-graal_$SUFFIX.txt)
if [[ 0 -eq ${diff_result} ]]; then
echo "congratulations, rendered by graal templates are the same"
else
echo "ERROR: rendered by graal templates are different"
exit 1
fi
fi
if [[ "kotlin-native" == ${impl_name} || "all" = ${impl_name} ]]; then
export PATH=$(pwd)/hiera-ctp-kotlin-native/build/bin/native/releaseExecutable:$PATH
echo "KOTLIN NATIVE: Running $(which hiera-ctp)"
echo "KOTLIN-NATIVE_$SUFFIX" >> test_times.txt
command time $timeDetais -o test_times.txt consul-template --vault-renew-token=false --once -template "tests/in.tpl:tests/target/out-kotlin-native_$SUFFIX.txt"
diff_result=$(diff tests/target/out-java_$SUFFIX.txt tests/target/out-kotlin-native_$SUFFIX.txt)
if [[ 0 -eq ${diff_result} ]]; then
echo "congratulations, rendered by kotlin-native templates are the same"
else
echo "ERROR: rendered by kotlin-native templates are different"
exit 1
fi
fi
}
export CLUSTER_LOCATION=us-west-1
export RELEASE=release1
runTemplates
export CLUSTER_LOCATION=us-east-2
runTemplates
export RELEASE=release2
runTemplates
export ENVIRONMENT=prod
runTemplates
ls -alh hiera-ctp-java/target/hiera-ctp
ls -alh $HOME/.cargo/bin/hiera-ctp
ls -alh $HOME/go/bin/hiera-ctp
ls -alh hiera-ctp-graal-native/hiera-ctp
ls -alh hiera-ctp-kotlin-native/build/bin/native/releaseExecutable/hiera-ctp