Skip to content

Commit 553b033

Browse files
committed
feat: implement static binaries and race-disabled tests for 1.X
1 parent f4f62f9 commit 553b033

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed

.circleci/config.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ workflows:
2020
version: ["2.0", "2.1", "2.2", "2.3"]
2121
- publish_docker_images:
2222
<<: *master_filter
23+
- test-influxdb-binaries:
24+
matrix:
25+
parameters:
26+
product: [ "influxdb/1.9/data", "influxdb/1.9/meta" ]
2327

2428
jobs:
2529
build:
@@ -39,7 +43,9 @@ jobs:
3943
enum: ["2.0", "2.1", "2.2", "2.3"]
4044
steps:
4145
- checkout
42-
- run: sudo apt-get update && sudo apt-get install -y jq
46+
- run: |
47+
sudo apt-get update &&
48+
sudo apt-get install -y jq
4349
- run: bash influxdb/test/test-2x-e2e.sh << parameters.version >>
4450
- store_artifacts:
4551
path: influxdb/test/logs
@@ -74,3 +80,14 @@ jobs:
7480
name: Do Enterprise Release
7581
command: |
7682
.circleci/scripts/do-enterprise-release
83+
84+
test-influxdb-binaries:
85+
machine: true
86+
parameters:
87+
product:
88+
type: string
89+
steps:
90+
- checkout
91+
- run:
92+
name: Validate Docker Image Binaries
93+
command: influxdb/test/test-binaries << parameters.product >>

influxdb/test/test-binaries

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/bash
2+
set -o errexit \
3+
-o nounset \
4+
-o pipefail
5+
6+
function build_local_image()
7+
{
8+
# ${1} -> directory
9+
# ${2} -> tag
10+
pushd "${1}"
11+
12+
docker build -t "${2}" .
13+
14+
popd
15+
}
16+
17+
# ${1} -> product
18+
build_local_image "${1}" "influxdb-test"
19+
20+
read -d '' -r PROGRAM <<'EOF' || true
21+
set -o errexit \
22+
-o nounset \
23+
-o pipefail \
24+
-o xtrace
25+
26+
export DEBIAN_FRONTEND=noninteractive
27+
apt-get update
28+
apt-get install --yes binutils
29+
30+
function test_race()
31+
{
32+
# ${1} -> target
33+
if grep --quiet 'WARNING\: DATA RACE' <<<"$(strings "${1}")"
34+
then
35+
printf 'Race-enabled binary detected: %s\n' "${1}" >&2 ; exit 1
36+
fi
37+
}
38+
39+
function test_static()
40+
{
41+
# ${1} -> target
42+
43+
# `ldd` has the disadavantage that it cannot differentiate between a binary
44+
# without a dynamic section and garbage. `file` requires somewhat brittle
45+
# string parsing. `readelf` + `grep` circumvents both of these problems.
46+
if ! readelf --dynamic "${1}" | \
47+
grep --silent 'There is no dynamic section in this file.'
48+
then
49+
printf 'Non-static binary detected: %s\n' "${1}" >&2 ; exit 1
50+
fi
51+
}
52+
53+
for target in \
54+
/usr/bin/influx \
55+
/usr/bin/influx_inspect \
56+
/usr/bin/influxd \
57+
/usr/bin/influxd-ctl \
58+
/usr/bin/influxd-meta
59+
do
60+
if [[ -x "${target}" ]]
61+
then
62+
test_race "${target}"
63+
test_static "${target}"
64+
fi
65+
done
66+
EOF
67+
68+
docker run -it "influxdb-test" bash -c "${PROGRAM}"

0 commit comments

Comments
 (0)