You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2018/11/07 21:01:06 UTC

[trafficcontrol] 02/04: Response to PR comments

This is an automated email from the ASF dual-hosted git repository.

dangogh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 2c466f1577a2f27c3fd9acf9840eff62cbbe475d
Author: moltzaum <ma...@moltzau.net>
AuthorDate: Thu Oct 25 15:25:05 2018 -0600

    Response to PR comments
---
 ...est.yml => docker-compose.traffic-ops-test.yml} |  4 +-
 .../Dockerfile                                     | 15 +++---
 .../config.sh                                      |  4 +-
 .../run.sh                                         |  0
 traffic_ops/testing/api/docker/Dockerfile          | 60 ----------------------
 .../testing/api/docker/Dockerfile-api-tests        | 34 ------------
 traffic_ops/testing/api/docker/README.md           | 27 ----------
 traffic_ops/testing/api/docker/docker-compose.yml  | 38 --------------
 traffic_ops/testing/api/docker/run_api_tests.sh    | 47 -----------------
 .../testing/api/docker/traffic-ops-test.env        | 29 -----------
 10 files changed, 11 insertions(+), 247 deletions(-)

diff --git a/infrastructure/cdn-in-a-box/docker-compose.totest.yml b/infrastructure/cdn-in-a-box/docker-compose.traffic-ops-test.yml
similarity index 98%
rename from infrastructure/cdn-in-a-box/docker-compose.totest.yml
rename to infrastructure/cdn-in-a-box/docker-compose.traffic-ops-test.yml
index 23f6dbd..c6dd25b 100644
--- a/infrastructure/cdn-in-a-box/docker-compose.totest.yml
+++ b/infrastructure/cdn-in-a-box/docker-compose.traffic-ops-test.yml
@@ -61,6 +61,6 @@ services:
       - ./dns/container-resolv.conf:/etc/resolv.conf
 
 volumes:
-    shared:
-        external: false
+  shared:
+    external: false
  
diff --git a/infrastructure/cdn-in-a-box/to_integration/Dockerfile b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
similarity index 84%
rename from infrastructure/cdn-in-a-box/to_integration/Dockerfile
rename to infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
index 0d9c7e0..41b40cf 100644
--- a/infrastructure/cdn-in-a-box/to_integration/Dockerfile
+++ b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
@@ -30,24 +30,23 @@ COPY ./infrastructure/cdn-in-a-box/ /go/src/github.com/apache/trafficcontrol/inf
 # 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
+RUN go test -c ./v1* -o traffic_ops_integration_test
 
 FROM debian:stretch
-# Based off enroller. Might be able to remove some things from the install.
 RUN apt-get update && apt-get install -y netcat curl dnsutils net-tools vim && apt-get clean
 
 # MANIFEST
-# run.sh                    (wait on TO, then run bin)
-# to-access.sh              (sourced, get to-ping and env vars)
-# config.sh                 (sourced, and creates config for bin file)
-# tc-fixtures.json          (test data to run tests with)
-# traffic_ops_integration   (main bin, from integration-builder)
+# run.sh                        (wait on TO, then run bin)
+# to-access.sh                  (sourced, get to-ping and env vars)
+# config.sh                     (sourced, and creates config for bin file)
+# tc-fixtures.json              (test data to run tests with)
+# traffic_ops_integration_test  (main bin, from integration-builder)
 COPY ./infrastructure/cdn-in-a-box/to_integration/run.sh    /opt/integration/app/
 COPY ./infrastructure/cdn-in-a-box/traffic_ops/to-access.sh /opt/integration/app/
 COPY ./infrastructure/cdn-in-a-box/to_integration/config.sh /opt/integration/app/
 COPY ./traffic_ops/testing/api/v14/tc-fixtures.json         /opt/integration/app/
 COPY --from=integration-builder \
-    /go/src/github.com/apache/trafficcontrol/traffic_ops/testing/api/traffic_ops_integration \
+    /go/src/github.com/apache/trafficcontrol/traffic_ops/testing/api/traffic_ops_integration_test \
     /opt/integration/app/
 
 WORKDIR /opt/integration/app
diff --git a/infrastructure/cdn-in-a-box/to_integration/config.sh b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/config.sh
similarity index 96%
rename from infrastructure/cdn-in-a-box/to_integration/config.sh
rename to infrastructure/cdn-in-a-box/traffic_ops_integration_test/config.sh
index c18eb11..b192ce9 100755
--- a/infrastructure/cdn-in-a-box/to_integration/config.sh
+++ b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/config.sh
@@ -24,7 +24,7 @@
 envvars=( DB_SERVER DB_PORT DB_ROOT_PASS DB_USER DB_USER_PASS ADMIN_USER ADMIN_PASS DOMAIN TO_PERL_HOST TO_PERL_PORT TO_HOST TO_PORT TP_HOST)
 for v in $envvars
 do
-	if [[ -z $$v ]]; then echo "$v is unset"; exit 1; fi
+    if [[ -z $$v ]]; then echo "$v is unset"; exit 1; fi
 done
 
 cat <<-EOF >/opt/integration/app/traffic-ops-test.conf
@@ -43,7 +43,7 @@ cat <<-EOF >/opt/integration/app/traffic-ops-test.conf
     },
     "trafficOps": {
         "URL": "https://$TO_HOST:$TO_PORT",
-	    "password": "$ADMIN_PASS",
+        "password": "$ADMIN_PASS",
         "users": {
             "disallowed": "disallowed",
             "operations": "operations",
diff --git a/infrastructure/cdn-in-a-box/to_integration/run.sh b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/run.sh
similarity index 100%
rename from infrastructure/cdn-in-a-box/to_integration/run.sh
rename to infrastructure/cdn-in-a-box/traffic_ops_integration_test/run.sh
diff --git a/traffic_ops/testing/api/docker/Dockerfile b/traffic_ops/testing/api/docker/Dockerfile
deleted file mode 100644
index a22cb61..0000000
--- a/traffic_ops/testing/api/docker/Dockerfile
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-FROM golang:1.10.1
-MAINTAINER Dewayne Richardson <de...@apache.org>
-
-RUN pwd
-ARG DB_NAME
-ARG DB_SERVER
-ARG DB_PORT
-ARG DB_USER
-ARG DB_PASSWORD
-ARG TO_URL
-ARG TODB_HOSTNAME
-ARG TODB_NAME
-
-ENV DB_NAME=$DB_SERVER
-ENV DB_SERVER=$DB_SERVER
-ENV DB_PORT=$DB_PORT
-ENV DB_USER=$DB_SERVER
-ENV DB_PASSWORD=$DB_PASSWORD
-ENV TO_URL=$TO_URL
-ENV TODB_HOSTNAME=$TODB_HOSTNAME
-ENV TODB_NAME=$TODB_NAME
-
-ARG SRC_DIR=/go/src
-ARG TC_DIR=$SRC_DIR/github.com/apache/trafficcontrol
-ARG TESTING_DIR=$TC_DIR/traffic_ops/testing
-ARG TESTING_API_DIR=$TESTING_DIR/api
- 
-#COPY --from=trafficops-perl /opt/traffic_ops/app/bin/traffic_ops_golang /opt/traffic_ops/app/bin/traffic_ops_golang
-#COPY --from=trafficops-perl /usr/local/go /usr/local/go
-
-WORKDIR $TC_DIR
-
-# Add the lib/go-tc dir
-ADD lib lib
-
-# Add the dependent dirs (without the cruft)
-ADD vendor vendor
-ADD traffic_ops/traffic_ops_golang traffic_ops/traffic_ops_golang
-ADD traffic_ops/vendor traffic_ops/vendor
-ADD traffic_ops/testing/api traffic_ops/testing/api
-ADD traffic_ops/client traffic_ops/client
-
-#ADD conf .
-WORKDIR $TESTING_API_DIR/v13
-CMD ../docker/run_api_tests.sh
-
-# vi:syntax=Dockerfile
diff --git a/traffic_ops/testing/api/docker/Dockerfile-api-tests b/traffic_ops/testing/api/docker/Dockerfile-api-tests
deleted file mode 100644
index dda13ac..0000000
--- a/traffic_ops/testing/api/docker/Dockerfile-api-tests
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-FROM golang:1.8
-MAINTAINER Dewayne Richardson <de...@apache.org>
-
-RUN apt-get -y update
-RUN apt-get -y install vim netcat
-
-ARG DIR=github.com/apache/trafficcontrol
-ARG DBHOST
-ARG DBPORT
-ENV DBHOST=$DBHOST
-ENV DBPORT=$DBPORT
-
-#ADD . $DIR
-ADD . /go/src/$DIR
-ADD lib /go/src/$DIR/lib
-
-WORKDIR /go/src/$DIR/traffic_ops/testing/api
-
-CMD bash -c 'docker/run_api_tests.sh'
- 
-# vi:syntax=Dockerfile
diff --git a/traffic_ops/testing/api/docker/README.md b/traffic_ops/testing/api/docker/README.md
deleted file mode 100644
index 98e1351..0000000
--- a/traffic_ops/testing/api/docker/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-
-# Traffic Ops API Tests in Docker
-
-The Traffic Ops Client API tests can also be run from Docker if necessary.  The only major difference is the TO API Test tool for Docker needs to be driven with 
-environment variables. By default the docker-compose.yml will look for it's default environment variables in the `docker/traffic-ops-test.env`
-
-When necessary the environment variables can be overridden via the command line docker-compose option as well like this:
-
-  $ docker-compose up --build 
diff --git a/traffic_ops/testing/api/docker/docker-compose.yml b/traffic_ops/testing/api/docker/docker-compose.yml
deleted file mode 100644
index 17c043e..0000000
--- a/traffic_ops/testing/api/docker/docker-compose.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#../../../../infrastructure/cdn-in-a-box/traffic_ops/
-#infrastructure/cdn-in-a-box/traffic_ops/
-
----
-version: '3'
-
-networks:
-  default:
-    external:
-      name: cdn-in-a-box_tcnet
-
-services:
-  trafficops_api_tests:
-    image: trafficops-api-tests
-    build:
-      context: ../../../..
-      dockerfile: traffic_ops/testing/api/docker/Dockerfile
-      args:
-        DB_SERVER: db
-        DB_PORT: 5432
-    env_file:
-      - traffic-ops-test.env
diff --git a/traffic_ops/testing/api/docker/run_api_tests.sh b/traffic_ops/testing/api/docker/run_api_tests.sh
deleted file mode 100755
index fd78af7..0000000
--- a/traffic_ops/testing/api/docker/run_api_tests.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Script for running the Dockerfile for Traffic Ops.
-# The Dockerfile sets up a Docker image which can be used for any new Traffic Ops container;
-# This script, which should be run when the container is run (it's the ENTRYPOINT), will configure the container.
-#
-source /etc/environment
-
-start() {
-   export PATH=/usr/local/go/bin:/opt/traffic_ops/go/bin:$PATH
-   export GOPATH=/go
-   go get -u golang.org/x/net/publicsuffix golang.org/x/crypto/scrypt
-   go test -v -cfg=../conf/traffic-ops-test.conf
-}
-
-
-set -x
-
-usage() {
-        echo "Usage: $(basename $0) <test dir> <test env> <host> <port>"
-        echo "  e.g. $(basename $0) ./t test db 5432"
-}
-
-finish() {
-        local st=$?
-        [[ $st -ne 0 ]] && echo "Exiting with status $st"
-        [[ -n $msg ]] && echo $msg
-}
-
-start
diff --git a/traffic_ops/testing/api/docker/traffic-ops-test.env b/traffic_ops/testing/api/docker/traffic-ops-test.env
deleted file mode 100644
index 2b51380..0000000
--- a/traffic_ops/testing/api/docker/traffic-ops-test.env
+++ /dev/null
@@ -1,29 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-TO_URL=https://trafficops:6443
-TO_USER=admin
-TO_USER_PASSWORD=twelve
-
-# API Test Tool vars
-TODB_HOSTNAME=db
-TODB_NAME=traffic_ops
-
-SSL_INSECURE=true
-DB_NAME=db
-DB_USER=traffic_ops
-DB_PASSWORD=twelve
-DB_PORT=5432