You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ma...@apache.org on 2020/03/06 19:26:28 UTC
[trafficcontrol] branch master updated: Integration test support to
run both TO v1 / v2 tests (#4463)
This is an automated email from the ASF dual-hosted git repository.
mattjackson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new a7f41a9 Integration test support to run both TO v1 / v2 tests (#4463)
a7f41a9 is described below
commit a7f41a9b26b96031e933ae18a598ecdba0741f3c
Author: Michael Hoppal <54...@users.noreply.github.com>
AuthorDate: Fri Mar 6 12:26:19 2020 -0700
Integration test support to run both TO v1 / v2 tests (#4463)
---
.../traffic_ops_integration_test/Dockerfile | 37 +++++++++++++++-------
.../traffic_ops_integration_test/run.sh | 15 ++++++++-
2 files changed, 39 insertions(+), 13 deletions(-)
diff --git a/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
index 7369cc8..768647c 100644
--- a/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
+++ b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
@@ -15,29 +15,39 @@
# specific language governing permissions and limitations
# under the License.
-FROM golang:1.11 AS integration-builder
+FROM golang:1.11.13-alpine3.10 AS integration-builder
+
+RUN apk add --no-cache --update git gcc
+
+RUN go get -u golang.org/x/net/publicsuffix golang.org/x/crypto/scrypt
+RUN go get -u github.com/jstemmer/go-junit-report
+RUN cd /go/src/github.com/jstemmer/go-junit-report && go build
# integration source and dependencies
-COPY ./lib/ /go/src/github.com/apache/trafficcontrol/lib/
+COPY ./infrastructure/cdn-in-a-box/ /go/src/github.com/apache/trafficcontrol/infrastructure/cdn-in-a-box/
COPY ./vendor/ /go/src/github.com/apache/trafficcontrol/vendor/
+COPY ./traffic_ops/vendor/ /go/src/github.com/apache/trafficcontrol/traffic_ops/vendor/
+COPY ./lib/ /go/src/github.com/apache/trafficcontrol/lib/
COPY ./traffic_ops/client/ /go/src/github.com/apache/trafficcontrol/traffic_ops/client/
COPY ./traffic_ops/v1-client/ /go/src/github.com/apache/trafficcontrol/traffic_ops/v1-client/
-COPY ./traffic_ops/vendor/ /go/src/github.com/apache/trafficcontrol/traffic_ops/vendor/
-COPY ./infrastructure/cdn-in-a-box/traffic_ops_integration_test/ /go/src/github.com/apache/trafficcontrol/infrastructure/cdn-in-a-box/traffic_ops_integration_test/
COPY ./traffic_ops/testing/api /go/src/github.com/apache/trafficcontrol/traffic_ops/testing/api
COPY ./traffic_ops/traffic_ops_golang /go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang
-COPY ./infrastructure/cdn-in-a-box/ /go/src/github.com/apache/trafficcontrol/infrastructure/cdn-in-a-box/
# if we end up using a different versioning convention, the compile command will need to change
WORKDIR /go/src/github.com/apache/trafficcontrol/traffic_ops/testing/api
-RUN go get -u golang.org/x/net/publicsuffix golang.org/x/crypto/scrypt
-RUN go test -c ./v1* -o traffic_ops_integration_test
+RUN CGO_ENABLED=0 go test -c ./v1* -ldflags="-w -s" -o traffic_ops_v1_integration_test
+RUN CGO_ENABLED=0 go test -c ./v2* -ldflags="-w -s" -o traffic_ops_v2_integration_test
-RUN go get -u github.com/jstemmer/go-junit-report
-RUN cd /go/src/github.com/jstemmer/go-junit-report && go build
+FROM alpine:3.11
-FROM debian:stretch
-RUN apt-get update && apt-get install -y netcat curl dnsutils net-tools postgresql-client && apt-get clean
+RUN apk add --no-cache --update \
+ curl \
+ wget \
+ bash \
+ nmap \
+ bind-tools \
+ net-tools \
+ postgresql-client
# MANIFEST
# run.sh (wait on TO, then run bin)
@@ -50,7 +60,10 @@ COPY ./infrastructure/cdn-in-a-box/traffic_ops/to-access.sh /opt/integration/app
COPY ./infrastructure/cdn-in-a-box/traffic_ops_integration_test/config.sh /opt/integration/app/
COPY ./traffic_ops/testing/api/v1/tc-fixtures.json /opt/integration/app/
COPY --from=integration-builder \
- /go/src/github.com/apache/trafficcontrol/traffic_ops/testing/api/traffic_ops_integration_test \
+ /go/src/github.com/apache/trafficcontrol/traffic_ops/testing/api/traffic_ops_v1_integration_test \
+ /opt/integration/app/
+COPY --from=integration-builder \
+ /go/src/github.com/apache/trafficcontrol/traffic_ops/testing/api/traffic_ops_v2_integration_test \
/opt/integration/app/
COPY --from=integration-builder \
diff --git a/infrastructure/cdn-in-a-box/traffic_ops_integration_test/run.sh b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/run.sh
index f7bb2d6..78f721c 100755
--- a/infrastructure/cdn-in-a-box/traffic_ops_integration_test/run.sh
+++ b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/run.sh
@@ -44,4 +44,17 @@ to-get api/2.0/dbdump > dbdump.api
diff dbdump.api dbdump.manual && rm -f dbdump.api dbdump.manual
-./traffic_ops_integration_test -test.v -cfg=traffic-ops-test.conf 2>&1 | ./go-junit-report --package-name=golang.test.toapi --set-exit-code > /junit/golang.test.toapi.xml && find /junit -type 'f' | xargs chmod 664 && cat /junit/golang.test.toapi.xml
+./traffic_ops_v1_integration_test -test.v -cfg=traffic-ops-test.conf 2>&1 | ./go-junit-report --package-name=golang.test.toapi.v1 --set-exit-code > /junit/golang.test.toapi.v1.xml && find /junit -type 'f' | xargs chmod 664
+export v1=$?
+./traffic_ops_v2_integration_test -test.v -cfg=traffic-ops-test.conf 2>&1 | ./go-junit-report --package-name=golang.test.toapi.v2 --set-exit-code > /junit/golang.test.toapi.v2.xml && find /junit -type 'f' | xargs chmod 664
+export v2=$?
+
+cat /junit/golang.test.toapi.v1.xml /junit/golang.test.toapi.v2.xml
+
+if [ $v1 -eq 0 ] && [ $v2 -eq 0 ]
+then
+ echo "TO API tests success"
+else
+ echo "TO API tests failed"
+ exit 1
+fi