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

jhg03a 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 6a20d6f  Traffic Ops integration tests (#4959)
6a20d6f is described below

commit 6a20d6f7e6da1184661b70674676861bce2b18a5
Author: ocket8888 <[email protected]>
AuthorDate: Tue Aug 18 16:21:20 2020 -0600

    Traffic Ops integration tests (#4959)
    
    * initial attempt at integration testing
    
    * Added db upgrades and actual test running
    
    * Fix bad job names
    
    * Fix postgres service version
    
    * Fix install command
    
    * Fix install command
    
    * Fix install command
    
    * Add 'git'
    
    * Add 'gcc'
    
    * Switch to ubuntu
    
    * Forgot 'install'
    
    * Add echoing steps to entrypoint
    
    * Fix db execution path
    
    * Move goose into PATH
    
    * use localhost instead of IP
    
    * I'm gonna try something weird
    
    * Fix dbname
    
    * Change command from upgrade to reset
    
    * Install postgresql client
    
    * Install postgresql client
    
    * wat
    
    * Why can't I install postgresql-client???
    
    * Refine package name
    
    * Forgot a space
    
    * Calling goose manually
    
    * Fix db order of operations
    
    * Add hand-made cert and key
    
    * fix path to go binary
    
    * fix path to go binary - but actually
    
    * fix configuration file name
    
    * remove unused code
    
    * Add running v2 and v3 tests
    
    * Fix if/then syntax
    
    * Remove echoing and errexit
    
    * fix path to logfiles
    
    * shorten logs
    
    * Add noPerl and noISO to testing configuration
    
    * Fix no closing "
    
    * Add missed Perl-dependent tests
    
    * Remove extraneous tests
    
    * Remove unused dependency, add path matching
    
    * Fix removing non-existent file
    
    * Move configuration files out into actual files
    
    * Fix package name
    
    * Move different versions into different steps
    
    * Make API v2 and v3 tests always run even if earlier versions failed
    
    * Fix 'always' syntax
    
    * Add input to action YML
    
    * Move todb initialization into its own action
    
    * Fix package name
    
    * Add missing packages
    
    * Run v2 and v3 only if db initialization succeeds
    
    * Alpine doesn't have stdio, so I'm using buster
    
    * Alpine doesn't have stdio, so I'm using buster
    
    * Remove unnecessary 'go get'
    
    * Add always() to later API version test conditionals
    
    * Try to switch back to Alpine
    
    * Fix apk command
---
 .github/actions/to-integration-tests/Dockerfile    |  26 +++++
 .github/actions/to-integration-tests/README.md     |  60 +++++++++++
 .github/actions/to-integration-tests/action.yml    |  28 ++++++
 .github/actions/to-integration-tests/cdn.json      |  51 ++++++++++
 .github/actions/to-integration-tests/database.json |  10 ++
 .github/actions/to-integration-tests/dbconf.yml    |  23 +++++
 .github/actions/to-integration-tests/entrypoint.sh | 111 +++++++++++++++++++++
 .../to-integration-tests/traffic-ops-test.json     |  38 +++++++
 .github/actions/todb-init/Dockerfile               |  29 ++++++
 .github/actions/todb-init/README.md                |  50 ++++++++++
 .github/actions/todb-init/action.yml               |  22 ++++
 .github/actions/todb-init/dbconf.yml               |  23 +++++
 .github/actions/todb-init/entrypoint.sh            |  28 ++++++
 .github/workflows/traffic ops.yml                  |  69 +++++++++++++
 .../testing/api/v1/federation_users_test.go        |   3 +
 traffic_ops/testing/api/v1/federations_test.go     |   3 +
 16 files changed, 574 insertions(+)

diff --git a/.github/actions/to-integration-tests/Dockerfile 
b/.github/actions/to-integration-tests/Dockerfile
new file mode 100644
index 0000000..3457f8d
--- /dev/null
+++ b/.github/actions/to-integration-tests/Dockerfile
@@ -0,0 +1,26 @@
+# 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.
+
+FROM golang:1.14.2-alpine
+
+ENV CGO_ENABLED=0
+RUN apk add --no-cache gettext git
+
+COPY entrypoint.sh database.json traffic-ops-test.json cdn.json /
+RUN chmod a+x /entrypoint.sh
+
+ENTRYPOINT /entrypoint.sh
diff --git a/.github/actions/to-integration-tests/README.md 
b/.github/actions/to-integration-tests/README.md
new file mode 100644
index 0000000..6f81959
--- /dev/null
+++ b/.github/actions/to-integration-tests/README.md
@@ -0,0 +1,60 @@
+<!--
+  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-integration-tests Docker action
+This action runs the Traffic Ops Go client integration tests with the Traffic
+Ops API.
+
+## Inputs
+
+### `version`
+**Required** Major API version to test e.g. 1, 2, 3 etc.
+
+## Outputs
+
+### `exit-code`
+1 if the Go program(s) could be built successfully.
+
+## Example usage
+```yaml
+jobs:
+  tests:
+    runs-on: ubuntu-latest
+
+    services:
+      postgres:
+        image: postgres:11.9
+        env:
+          POSTGRES_USER: traffic_ops
+          POSTGRES_PASSWORD: twelve
+          POSTGRES_DB: traffic_ops
+        ports:
+        - 5432:5432
+        options: --health-cmd pg_isready --health-interval 10s 
--health-timeout 5s --health-retries 5
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@master
+      - name: initialize database
+        uses: ./.github/actions/todb-init
+      - name: Run API v5 tests
+        uses: ./.github/actions/to-integration-tests
+        with:
+          version: 5
+```
diff --git a/.github/actions/to-integration-tests/action.yml 
b/.github/actions/to-integration-tests/action.yml
new file mode 100644
index 0000000..8c9d57f
--- /dev/null
+++ b/.github/actions/to-integration-tests/action.yml
@@ -0,0 +1,28 @@
+# 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.
+
+name: 'to-integration-tests'
+description: 'Runs Traffic Ops Go client/API integration tests'
+inputs:
+  version:
+    description: 'Version of Traffic Ops API against which to run tests, e.g. 
1, 2, 3, etc.'
+    required: true
+runs:
+  using: 'docker'
+  image: 'Dockerfile'
+  args:
+    - ${{ inputs.version }}
diff --git a/.github/actions/to-integration-tests/cdn.json 
b/.github/actions/to-integration-tests/cdn.json
new file mode 100644
index 0000000..efda921
--- /dev/null
+++ b/.github/actions/to-integration-tests/cdn.json
@@ -0,0 +1,51 @@
+{
+       "hypnotoad" : {
+               "listen" : [
+                       
"https://not-a-real-host.test:1?cert=$PWD/localhost.crt&key=$PWD/localhost.key&verify=0x00&ciphers=AES128-GCM-SHA256:HIGH:!RC4:!MD5:!aNULL:!EDH:!ED";
+               ],
+               "user" : "trafops",
+               "group" : "trafops",
+               "heartbeat_timeout" : 20,
+               "pid_file" : "/var/run/traffic_ops.pid",
+               "workers" : 12
+       },
+       "use_ims": true,
+       "traffic_ops_golang" : {
+               "insecure": true,
+               "port" : "6443",
+               "log_location_error": "stderr",
+               "log_location_warning": "stderr",
+               "log_location_info": null,
+               "log_location_debug": null,
+               "log_location_event": null,
+               "max_db_connections": 20,
+               "db_conn_max_lifetime_seconds": 60,
+               "db_query_timeout_seconds": 20,
+               "supported_ds_metrics": [ "kbps", "tps_total", "tps_2xx", 
"tps_3xx", "tps_4xx", "tps_5xx" ]
+       },
+       "cors" : {
+               "access_control_allow_origin" : "*"
+       },
+       "to" : {
+               "base_url" : "https://localhost";,
+               "email_from" : "[email protected]",
+               "no_account_found_msg" : "A Traffic Ops user account is 
required for access. Please contact your Traffic Ops user administrator."
+       },
+       "portal" : {
+               "base_url" : "https://not-a-real-host.test/#!/";,
+               "email_from" : "[email protected]",
+               "pass_reset_path" : "user",
+               "user_register_path" : "user"
+       },
+       "secrets" : [
+               "blahblah"
+       ],
+       "geniso" : {
+               "iso_root_path" : "/opt/traffic_ops/app/public"
+       },
+       "inactivity_timeout" : 60,
+       "smtp" : {
+               "enabled" : false
+       },
+       "InfluxEnabled": false
+}
diff --git a/.github/actions/to-integration-tests/database.json 
b/.github/actions/to-integration-tests/database.json
new file mode 100644
index 0000000..8d08eb4
--- /dev/null
+++ b/.github/actions/to-integration-tests/database.json
@@ -0,0 +1,10 @@
+{
+       "description": "Local PostgreSQL database on port 5432",
+       "dbname": "traffic_ops",
+       "hostname": "postgres",
+       "user": "traffic_ops",
+       "password": "twelve",
+       "port": "5432",
+       "ssl": false,
+       "type": "Pg"
+}
diff --git a/.github/actions/to-integration-tests/dbconf.yml 
b/.github/actions/to-integration-tests/dbconf.yml
new file mode 100644
index 0000000..f565670
--- /dev/null
+++ b/.github/actions/to-integration-tests/dbconf.yml
@@ -0,0 +1,23 @@
+# 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.
+version: "1.0"
+name: dbconf.yml
+
+test:
+  driver: postgres
+  open: host=postgres port=5432 user=traffic_ops password=twelve 
dbname=traffic_ops sslmode=disable
+
diff --git a/.github/actions/to-integration-tests/entrypoint.sh 
b/.github/actions/to-integration-tests/entrypoint.sh
new file mode 100644
index 0000000..cc99f4a
--- /dev/null
+++ b/.github/actions/to-integration-tests/entrypoint.sh
@@ -0,0 +1,111 @@
+#!/bin/sh -l
+# 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.
+
+GOPATH="$(mktemp -d)"
+SRCDIR="$GOPATH/src/github.com/apache"
+mkdir -p "$SRCDIR"
+ln -s "$PWD" "$SRCDIR/trafficcontrol"
+
+cd "$SRCDIR/trafficcontrol/traffic_ops/traffic_ops_golang"
+
+
+/usr/local/go/bin/go get ./...
+/usr/local/go/bin/go build .
+
+echo "
+-----BEGIN CERTIFICATE-----
+MIIDtTCCAp2gAwIBAgIJAJgQuE9T48+gMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
+aWRnaXRzIFB0eSBMdGQwHhcNMTcwNTA5MDIyNTI0WhcNMTgwNTA5MDIyNTI0WjBF
+MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
+ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEA1OsuQ71qaSZ4ivGnh4YryeQEHMn5wZLX7kWYB637ssyOJnkU1ZGs93JM
+XJADzs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WOHCw2NIf
+CqX3V5vubhe6WcY4bY5MttM/yLvwPKUZeng57PDqucV9zzkuoKfiCdXCcRpaGDEp
+okOooghj4ip204WDg6NTDZkCgYEAwZTfzsGLgmF1kRBIoZqmt1zeUcQxHfhKx32Y
+BaM7/EtD/rSEAz7NEtBa9uLOL77rlSdZL3KcGXck0efFckitFkCqtIQBAoaf1E12
+vS9tV0/6QBAjZByhgM0Qnt/Uad7k2/vilUmZ9TkoMVy9kdm3xCFCowP14OKb+uK4
+YxBQc7ECgYEAm7eVtNlPHYmC54FU2bLucryNMLmu9I8O6zvbK5sxiMdtlh7OjaUB
+RQS5iVc0iTacDZTGh7eqNzgGplj76pWGHeZUy0xIj/ZIRu2qOy0v+ffqfX1wCz7p
+A22D22wvfs7CE3cUz/8UnvLM3kbTTu1WbbBbrHjAV47sAHjW/ckTqeo=
+-----END RSA PRIVATE KEY-----
+" > localhost.key
+
+envsubst </cdn.json >cdn.conf
+mv /database.json ./database.conf
+
+./traffic_ops_golang --cfg ./cdn.conf --dbcfg ./database.conf >out.log 
2>err.log &
+
+if [ -z "$INPUT_VERSION" ]; then
+       INPUT_VERSION="3";
+fi
+
+cd "../testing/api/v$INPUT_VERSION"
+
+cp /traffic-ops-test.json ./traffic-ops-test.conf
+/usr/local/go/bin/go test -v --cfg ./traffic-ops-test.conf
+CODE="$?"
+rm traffic-ops-test.conf
+
+# TODO - make these build artifacts
+if [ -f ../../../traffic_ops_golang/out.log ]; then
+       cat ../../../traffic_ops_golang/out.log
+       rm ../.../../traffic_ops_golang/out.log
+fi
+
+if [ -f ../../../traffic_ops_golang/err.log ]; then
+       cat ../../../traffic_ops_golang/err.log >&2
+       rm ../../../traffic_ops_golang/err.log
+fi
+
+exit "$CODE"
diff --git a/.github/actions/to-integration-tests/traffic-ops-test.json 
b/.github/actions/to-integration-tests/traffic-ops-test.json
new file mode 100644
index 0000000..78c96ea
--- /dev/null
+++ b/.github/actions/to-integration-tests/traffic-ops-test.json
@@ -0,0 +1,38 @@
+{
+       "default": {
+               "logLocations": {
+                       "debug": "stderr",
+                       "error": "stderr",
+                       "event": "stderr",
+                       "info": "stderr",
+                       "warning": "stderr"
+               },
+               "session": {
+                       "timeoutInSecs": 60
+               }
+       },
+       "trafficOps": {
+               "URL": "https://localhost:6443";,
+               "password": "twelve",
+               "users": {
+                       "disallowed": "disallowed",
+                       "operations": "operations",
+                       "admin": "admin",
+                       "federation": "federation",
+                       "portal": "portal",
+                       "readOnly": "readOnly",
+                       "extension": "extension"
+               }
+       },
+       "trafficOpsDB": {
+               "dbname": "traffic_ops",
+               "description": "Test database to_test",
+               "hostname": "postgres",
+               "password": "twelve",
+               "port": "5432",
+               "type": "Pg",
+               "user": "traffic_ops"
+       },
+       "noPerl": true,
+       "noISO": true
+}
diff --git a/.github/actions/todb-init/Dockerfile 
b/.github/actions/todb-init/Dockerfile
new file mode 100644
index 0000000..d5836ab
--- /dev/null
+++ b/.github/actions/todb-init/Dockerfile
@@ -0,0 +1,29 @@
+# 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.
+
+FROM golang:1.14.2-alpine
+
+RUN apk add --no-cache git gcc gettext postgresql-client musl-dev &&\
+       go get -v bitbucket.org/liamstask/goose/cmd/goose &&\
+       mv $GOPATH/bin/goose /bin/ &&\
+       apk del git gcc musl-dev
+
+
+COPY entrypoint.sh dbconf.yml /
+RUN chmod a+x /entrypoint.sh
+
+ENTRYPOINT /entrypoint.sh
diff --git a/.github/actions/todb-init/README.md 
b/.github/actions/todb-init/README.md
new file mode 100644
index 0000000..c341d44
--- /dev/null
+++ b/.github/actions/todb-init/README.md
@@ -0,0 +1,50 @@
+<!--
+  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.
+-->
+
+# todb-init Docker action
+This action initializes a Traffic Ops database in a locally running PostgresQL
+instance.
+
+## Outputs
+
+### `exit-code`
+1 if the database initialized successfully.
+
+## Example usage
+```yaml
+jobs:
+  tests:
+    runs-on: ubuntu-latest
+
+    services:
+      postgres:
+        image: postgres:11.9
+        env:
+          POSTGRES_USER: traffic_ops
+          POSTGRES_PASSWORD: twelve
+          POSTGRES_DB: traffic_ops
+        ports:
+        - 5432:5432
+        options: --health-cmd pg_isready --health-interval 10s 
--health-timeout 5s --health-retries 5
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@master
+      - name: ./.github/actions/todb-init
+```
diff --git a/.github/actions/todb-init/action.yml 
b/.github/actions/todb-init/action.yml
new file mode 100644
index 0000000..394fa96
--- /dev/null
+++ b/.github/actions/todb-init/action.yml
@@ -0,0 +1,22 @@
+# 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.
+
+name: 'todb-init'
+description: 'Initializes a Traffic Ops database using a local PostgreSQL 
instance'
+runs:
+  using: 'docker'
+  image: 'Dockerfile'
diff --git a/.github/actions/todb-init/dbconf.yml 
b/.github/actions/todb-init/dbconf.yml
new file mode 100644
index 0000000..f565670
--- /dev/null
+++ b/.github/actions/todb-init/dbconf.yml
@@ -0,0 +1,23 @@
+# 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.
+version: "1.0"
+name: dbconf.yml
+
+test:
+  driver: postgres
+  open: host=postgres port=5432 user=traffic_ops password=twelve 
dbname=traffic_ops sslmode=disable
+
diff --git a/.github/actions/todb-init/entrypoint.sh 
b/.github/actions/todb-init/entrypoint.sh
new file mode 100644
index 0000000..a951ce4
--- /dev/null
+++ b/.github/actions/todb-init/entrypoint.sh
@@ -0,0 +1,28 @@
+#!/bin/sh -l
+# 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.
+
+set -e
+
+cd "traffic_ops/app/db"
+
+mv /dbconf.yml ./
+
+psql -d postgresql://traffic_ops:twelve@postgres:5432/traffic_ops < 
./create_tables.sql >/dev/null
+goose --env=test --path="$PWD" up
+psql -d postgresql://traffic_ops:twelve@postgres:5432/traffic_ops < 
./seeds.sql >/dev/null
+psql -d postgresql://traffic_ops:twelve@postgres:5432/traffic_ops < 
./patches.sql >/dev/null
diff --git a/.github/workflows/traffic ops.yml b/.github/workflows/traffic 
ops.yml
new file mode 100644
index 0000000..0db639f
--- /dev/null
+++ b/.github/workflows/traffic ops.yml 
@@ -0,0 +1,69 @@
+# 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.
+
+name: Traffic Ops Go client/API integration tests
+
+on:
+  push:
+    paths:
+      - traffic_ops/traffic_ops_golang/**.go
+      - traffic_ops/testing/api/**.go
+      - traffic_ops/*client/**.go
+  create:
+  pull_request:
+    paths:
+      - traffic_ops/traffic_ops_golang/**.go
+      - traffic_ops/testing/api/**.go
+      - traffic_ops/*client/**.go
+    types: [opened, reopened, edited, synchronize]
+
+jobs:
+
+  API_tests:
+    runs-on: ubuntu-latest
+
+    services:
+      postgres:
+        image: postgres:11
+        env:
+          POSTGRES_USER: traffic_ops
+          POSTGRES_PASSWORD: twelve
+          POSTGRES_DB: traffic_ops
+        ports:
+        - 5432:5432
+        options: --health-cmd pg_isready --health-interval 10s 
--health-timeout 5s --health-retries 5
+
+    steps:
+    - name: Checkout
+      uses: actions/checkout@master
+    - name: Initialize Traffic Ops Database
+      id: todb
+      uses: ./.github/actions/todb-init
+    - name: Run API v1 tests
+      uses: ./.github/actions/to-integration-tests
+      with:
+        version: 1
+    - name: Run API v2 tests
+      if: ${{ steps.todb.outcome == 'success' && always() }}
+      uses: ./.github/actions/to-integration-tests
+      with:
+        version: 2
+    - name: Run API v3 tests
+      if: ${{ steps.todb.outcome == 'success' && always() }}
+      uses: ./.github/actions/to-integration-tests
+      with:
+        version: 3
diff --git a/traffic_ops/testing/api/v1/federation_users_test.go 
b/traffic_ops/testing/api/v1/federation_users_test.go
index 4473c35..2ec7417 100644
--- a/traffic_ops/testing/api/v1/federation_users_test.go
+++ b/traffic_ops/testing/api/v1/federation_users_test.go
@@ -20,6 +20,9 @@ import (
 )
 
 func TestFederationUsers(t *testing.T) {
+       if Config.NoPerl {
+               t.Skip("No Perl instance for proxying")
+       }
        WithObjs(t, []TCObj{CDNs, Types, Tenants, Users, Parameters, Profiles, 
Statuses, Divisions, Regions, PhysLocations, CacheGroups, DeliveryServices, 
UsersDeliveryServices, CDNFederations, FederationUsers}, func() {
                CreateTestInvalidFederationUsers(t)
                GetTestInvalidFederationIDUsers(t)
diff --git a/traffic_ops/testing/api/v1/federations_test.go 
b/traffic_ops/testing/api/v1/federations_test.go
index 0b62080..28c608b 100644
--- a/traffic_ops/testing/api/v1/federations_test.go
+++ b/traffic_ops/testing/api/v1/federations_test.go
@@ -24,6 +24,9 @@ import (
 )
 
 func TestFederations(t *testing.T) {
+       if Config.NoPerl {
+               t.Skip("No Perl instance for proxying")
+       }
        WithObjs(t, []TCObj{CDNs, Types, Tenants, Parameters, Profiles, 
Statuses, Divisions, Regions, PhysLocations, CacheGroups, DeliveryServices, 
UsersDeliveryServices, CDNFederations}, func() {
                PostDeleteTestFederationsDeliveryServices(t)
                GetTestFederations(t)

Reply via email to