Skip to content

Commit 8209588

Browse files
committed
tests/cstrans-df-run: basic test coverage
1 parent 9a276f7 commit 8209588

13 files changed

+228
-0
lines changed

tests/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ macro(test_cssort dir num)
105105
add_test_wrap("${dir}-${num}-by-path" "${cmd}")
106106
endmacro()
107107

108+
# a generic template for cstrans-df-run tests
109+
macro(tests_cstrans_df_run tst)
110+
set(test_data_prefix "${testdir}/cstrans-df-run/${tst}")
111+
set(cmd "${csdiff_BINARY_DIR}/cstrans-df-run")
112+
set(cmd "${cmd} -- /opt/cov-sa-2019.09/bin/cov-build --dir=/cov --append-log")
113+
set(cmd "${cmd} <${test_data_prefix}-stdin.txt")
114+
set(cmd "${cmd} | ${diffcmd} ${test_data_prefix}-stdout.txt -")
115+
add_test_wrap("cstrans-df-run-${tst}" "${cmd}")
116+
endmacro()
117+
108118
# csgrep tests
109119
test_csgrep(csgrep "00-exclude-conftest" )
110120
test_csgrep(csgrep "01-remove-duplicates" )
@@ -192,3 +202,11 @@ test_csdiff(diff-misc 05)
192202
test_csdiff(diff-misc 06)
193203
test_csdiff(diff-misc 07)
194204
test_csdiff(diff-misc 08)
205+
206+
# cstrans-df-run tests
207+
tests_cstrans_df_run(0001)
208+
tests_cstrans_df_run(0002)
209+
tests_cstrans_df_run(0003)
210+
tests_cstrans_df_run(0004)
211+
tests_cstrans_df_run(0005)
212+
tests_cstrans_df_run(0006)

tests/cstrans-df-run/0001-stdin.txt

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
4+
ARG ALERTMANAGER_GOPATH=/go/src/github.com/prometheus/alertmanager
5+
ARG BUILD_PROMU=false
6+
COPY . ${ALERTMANAGER_GOPATH}
7+
RUN cd ${ALERTMANAGER_GOPATH} && \
8+
yum install -y prometheus-promu && \
9+
make build && \
10+
yum clean all
11+
12+
FROM ubi7:7.6-159
13+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
14+
15+
ARG ALERTMANAGER_GOPATH=/go/src/github.com/prometheus/alertmanager
16+
COPY --from=builder ${ALERTMANAGER_GOPATH}/amtool /bin/amtool
17+
COPY --from=builder ${ALERTMANAGER_GOPATH}/alertmanager /bin/alertmanager
18+
COPY --from=builder ${ALERTMANAGER_GOPATH}/examples/ha/alertmanager.yml /etc/alertmanager/alertmanager.yml
19+
20+
EXPOSE 9093
21+
RUN mkdir -p /alertmanager
22+
VOLUME [ "/alertmanager" ]
23+
WORKDIR /etc/alertmanager
24+
ENTRYPOINT [ "/bin/alertmanager" ]
25+
CMD [ "--storage.path=/alertmanager" ]
26+
27+
LABEL \
28+
io.k8s.description="This is the Prometheus Alert Manager image." \
29+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
30+
maintainer="OpenShift Development <[email protected]>" \
31+
name="openshift/ose-prometheus-alertmanager" \
32+
License="ASL 2.0" \
33+
io.k8s.display-name="Prometheus Alert Manager" \
34+
io.openshift.build.source-location="https://github.com/openshift/prometheus-alertmanager" \
35+
io.openshift.build.commit.url="https://github.com/openshift/prometheus-alertmanager/commit/39c2c111ea818cd16dbd11e31cc682cf2b4042d3" \
36+
version="v4.1.0" \
37+
io.openshift.build.commit.id="39c2c111ea818cd16dbd11e31cc682cf2b4042d3" \
38+
release="201905191700" \
39+
vendor="Red Hat" \
40+
io.openshift.tags="openshift,prometheus"
41+

tests/cstrans-df-run/0001-stdout.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
4+
ARG ALERTMANAGER_GOPATH=/go/src/github.com/prometheus/alertmanager
5+
ARG BUILD_PROMU=false
6+
COPY . ${ALERTMANAGER_GOPATH}
7+
RUN ["/opt/cov-sa-2019.09/bin/cov-build", "--dir=/cov", "--append-log", "sh", "-c", "cd ${ALERTMANAGER_GOPATH} && yum install -y prometheus-promu && make build && yum clean all"]
8+
9+
FROM ubi7:7.6-159
10+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
11+
12+
ARG ALERTMANAGER_GOPATH=/go/src/github.com/prometheus/alertmanager
13+
COPY --from=builder ${ALERTMANAGER_GOPATH}/amtool /bin/amtool
14+
COPY --from=builder ${ALERTMANAGER_GOPATH}/alertmanager /bin/alertmanager
15+
COPY --from=builder ${ALERTMANAGER_GOPATH}/examples/ha/alertmanager.yml /etc/alertmanager/alertmanager.yml
16+
17+
EXPOSE 9093
18+
RUN ["/opt/cov-sa-2019.09/bin/cov-build", "--dir=/cov", "--append-log", "sh", "-c", "mkdir -p /alertmanager"]
19+
VOLUME [ "/alertmanager" ]
20+
WORKDIR /etc/alertmanager
21+
ENTRYPOINT [ "/bin/alertmanager" ]
22+
CMD [ "--storage.path=/alertmanager" ]
23+
24+
LABEL \
25+
io.k8s.description="This is the Prometheus Alert Manager image." \
26+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
27+
maintainer="OpenShift Development <[email protected]>" \
28+
name="openshift/ose-prometheus-alertmanager" \
29+
License="ASL 2.0" \
30+
io.k8s.display-name="Prometheus Alert Manager" \
31+
io.openshift.build.source-location="https://github.com/openshift/prometheus-alertmanager" \
32+
io.openshift.build.commit.url="https://github.com/openshift/prometheus-alertmanager/commit/39c2c111ea818cd16dbd11e31cc682cf2b4042d3" \
33+
version="v4.1.0" \
34+
io.openshift.build.commit.id="39c2c111ea818cd16dbd11e31cc682cf2b4042d3" \
35+
release="201905191700" \
36+
vendor="Red Hat" \
37+
io.openshift.tags="openshift,prometheus"
38+

tests/cstrans-df-run/0002-stdin.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
COPY . ${ALERTMANAGER_GOPATH}
4+
RUN cd ${ALERTMANAGER_GOPATH} && yum install -y prometheus-promu && make build && yum clean all
5+
FROM ubi7:7.6-159
6+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
7+
8+
CMD [ "--storage.path=/alertmanager" ]
9+
10+
LABEL \
11+
io.k8s.description="This is the Prometheus Alert Manager image." \
12+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
13+
maintainer="OpenShift Development <[email protected]>"

tests/cstrans-df-run/0002-stdout.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
COPY . ${ALERTMANAGER_GOPATH}
4+
RUN ["/opt/cov-sa-2019.09/bin/cov-build", "--dir=/cov", "--append-log", "sh", "-c", "cd ${ALERTMANAGER_GOPATH} && yum install -y prometheus-promu && make build && yum clean all"]
5+
FROM ubi7:7.6-159
6+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
7+
8+
CMD [ "--storage.path=/alertmanager" ]
9+
10+
LABEL \
11+
io.k8s.description="This is the Prometheus Alert Manager image." \
12+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
13+
maintainer="OpenShift Development <[email protected]>"

tests/cstrans-df-run/0003-stdin.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
COPY . ${ALERTMANAGER_GOPATH}
4+
RUN ["make"]
5+
FROM ubi7:7.6-159
6+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
7+
8+
CMD [ "--storage.path=/alertmanager" ]
9+
10+
LABEL \
11+
io.k8s.description="This is the Prometheus Alert Manager image." \
12+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
13+
maintainer="OpenShift Development <[email protected]>"

tests/cstrans-df-run/0003-stdout.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
COPY . ${ALERTMANAGER_GOPATH}
4+
RUN ["/opt/cov-sa-2019.09/bin/cov-build", "--dir=/cov", "--append-log", "make"]
5+
FROM ubi7:7.6-159
6+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
7+
8+
CMD [ "--storage.path=/alertmanager" ]
9+
10+
LABEL \
11+
io.k8s.description="This is the Prometheus Alert Manager image." \
12+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
13+
maintainer="OpenShift Development <[email protected]>"

tests/cstrans-df-run/0004-stdin.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
COPY . ${ALERTMANAGER_GOPATH}
4+
RUN ["go", "build","--verbose"]
5+
FROM ubi7:7.6-159
6+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
7+
8+
CMD [ "--storage.path=/alertmanager" ]
9+
10+
LABEL \
11+
io.k8s.description="This is the Prometheus Alert Manager image." \
12+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
13+
maintainer="OpenShift Development <[email protected]>"

tests/cstrans-df-run/0004-stdout.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
COPY . ${ALERTMANAGER_GOPATH}
4+
RUN ["/opt/cov-sa-2019.09/bin/cov-build", "--dir=/cov", "--append-log", "go", "build", "--verbose"]
5+
FROM ubi7:7.6-159
6+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
7+
8+
CMD [ "--storage.path=/alertmanager" ]
9+
10+
LABEL \
11+
io.k8s.description="This is the Prometheus Alert Manager image." \
12+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
13+
maintainer="OpenShift Development <[email protected]>"

tests/cstrans-df-run/0005-stdin.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
COPY . ${ALERTMANAGER_GOPATH}
4+
RUN ["sh", "-c", "echo \"OK\""]
5+
FROM ubi7:7.6-159
6+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
7+
8+
CMD [ "--storage.path=/alertmanager" ]
9+
10+
LABEL \
11+
io.k8s.description="This is the Prometheus Alert Manager image." \
12+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
13+
maintainer="OpenShift Development <[email protected]>"

tests/cstrans-df-run/0005-stdout.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
COPY . ${ALERTMANAGER_GOPATH}
4+
RUN ["/opt/cov-sa-2019.09/bin/cov-build", "--dir=/cov", "--append-log", "sh", "-c", "echo \"OK\""]
5+
FROM ubi7:7.6-159
6+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
7+
8+
CMD [ "--storage.path=/alertmanager" ]
9+
10+
LABEL \
11+
io.k8s.description="This is the Prometheus Alert Manager image." \
12+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
13+
maintainer="OpenShift Development <[email protected]>"

tests/cstrans-df-run/0006-stdin.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
COPY . ${ALERTMANAGER_GOPATH}
4+
RUN ["sh", "-c", \
5+
"echo \"OK\""]
6+
FROM ubi7:7.6-159
7+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
8+
9+
CMD [ "--storage.path=/alertmanager" ]
10+
11+
LABEL \
12+
io.k8s.description="This is the Prometheus Alert Manager image." \
13+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
14+
maintainer="OpenShift Development <[email protected]>"

tests/cstrans-df-run/0006-stdout.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM openshift/golang-builder:1.11 AS builder
2+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
3+
COPY . ${ALERTMANAGER_GOPATH}
4+
RUN ["/opt/cov-sa-2019.09/bin/cov-build", "--dir=/cov", "--append-log", "sh", "-c", "echo \"OK\""]
5+
FROM ubi7:7.6-159
6+
ENV SOURCE_GIT_COMMIT=39c2c111ea818cd16dbd11e31cc682cf2b4042d3 SOURCE_GIT_TAG=golang-github-prometheus-alertmanager-4.0.0-0.100.0-115-g39c2c11
7+
8+
CMD [ "--storage.path=/alertmanager" ]
9+
10+
LABEL \
11+
io.k8s.description="This is the Prometheus Alert Manager image." \
12+
com.redhat.component="golang-github-prometheus-alertmanager-container" \
13+
maintainer="OpenShift Development <[email protected]>"

0 commit comments

Comments
 (0)