You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by oc...@apache.org on 2023/01/20 02:47:04 UTC
[trafficcontrol] branch master updated: Separate Go Unit GHA into individual workflows (#7298)
This is an automated email from the ASF dual-hosted git repository.
ocket8888 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 e594d418b0 Separate Go Unit GHA into individual workflows (#7298)
e594d418b0 is described below
commit e594d418b020946fa62ae0a6b471d82a448c66e2
Author: Eric Holguin <14...@users.noreply.github.com>
AuthorDate: Thu Jan 19 19:46:55 2023 -0700
Separate Go Unit GHA into individual workflows (#7298)
* Added v5 test files
* Separated unit tests to own workflows
* renamed workflow
* added conditional for specific cache config test
* fix cache config unit tests failure
* more fixes
* rename job
* fixes
* added back paths and increase path coverage
* change paths to include all go files
---
.github/actions/go-test/entrypoint.sh | 11 +-
.github/workflows/cache-config.unit.tests.yml | 72 +++++++
.github/workflows/go.lib.unit.tests.yml | 72 +++++++
.github/workflows/go.unit.tests.yaml | 219 ---------------------
.github/workflows/grove.unit.tests.yml | 72 +++++++
.github/workflows/tm.unit.tests.yml | 72 +++++++
.../{traffic-ops.yml => to.integration.tests.yml} | 4 +-
.github/workflows/to.unit.tests.yml | 72 +++++++
.github/workflows/traffic-stats.unit.tests.yml | 72 +++++++
.../traffic_ops_integration_test/Dockerfile | 4 +-
10 files changed, 447 insertions(+), 223 deletions(-)
diff --git a/.github/actions/go-test/entrypoint.sh b/.github/actions/go-test/entrypoint.sh
index 1ca3f56565..9ba4680476 100755
--- a/.github/actions/go-test/entrypoint.sh
+++ b/.github/actions/go-test/entrypoint.sh
@@ -38,5 +38,14 @@ if ! [ -d "${GITHUB_WORKSPACE}/vendor/golang.org" ]; then
go mod vendor
fi
-go test --buildvcs=false $INPUT_DIR -coverpkg=$INPUT_DIR -coverprofile="$TEST_NAME-coverage.out"
+export GOFLAGS="-buildvcs=false"
+
+# t3c-check-refs requires a binary in order to test
+# cache-config tests need to ignore the testing directory
+if [ $TEST_NAME == "cache-config" ]; then
+ go build -o ./cache-config/t3c-check-refs/ ./cache-config/t3c-check-refs/t3c-check-refs.go
+ go test $(go list $INPUT_DIR | grep -v /testing/) -coverpkg=$INPUT_DIR -coverprofile="$TEST_NAME-coverage.out"
+else
+ go test $INPUT_DIR -coverpkg=$INPUT_DIR -coverprofile="$TEST_NAME-coverage.out"
+fi
exit $?
diff --git a/.github/workflows/cache-config.unit.tests.yml b/.github/workflows/cache-config.unit.tests.yml
new file mode 100644
index 0000000000..0aa9a470cd
--- /dev/null
+++ b/.github/workflows/cache-config.unit.tests.yml
@@ -0,0 +1,72 @@
+# 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: T3C Unit Tests
+
+env:
+ # alpine:3.13
+ ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930
+
+on:
+ push:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/cache-config.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ create:
+ pull_request:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/cache-config.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ types: [opened, reopened, ready_for_review, synchronize]
+
+jobs:
+ t3c_unit_tests:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ - name: Cache Alpine Docker image
+ uses: actions/cache@v2
+ with:
+ path: ${{ github.workspace }}/docker-images
+ key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
+ - name: Import cached Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
+ - name: Run T3C unit tests
+ uses: ./.github/actions/go-test
+ with:
+ dir: ./cache-config/...
+ test_name: cache-config
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: cache-config-coverage.out
+ flags: t3c_unit,unit_tests
+ - name: Save Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
diff --git a/.github/workflows/go.lib.unit.tests.yml b/.github/workflows/go.lib.unit.tests.yml
new file mode 100644
index 0000000000..c5c9fcd5c2
--- /dev/null
+++ b/.github/workflows/go.lib.unit.tests.yml
@@ -0,0 +1,72 @@
+# 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: Go Lib Unit Tests
+
+env:
+ # alpine:3.13
+ ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930
+
+on:
+ push:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/go.lib.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ create:
+ pull_request:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/go.lib.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ types: [opened, reopened, ready_for_review, synchronize]
+
+jobs:
+ go_lib_unit_tests:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ - name: Cache Alpine Docker image
+ uses: actions/cache@v2
+ with:
+ path: ${{ github.workspace }}/docker-images
+ key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
+ - name: Import cached Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
+ - name: Run Go Lib unit tests
+ uses: ./.github/actions/go-test
+ with:
+ dir: ./lib/...
+ test_name: golib
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: golib-coverage.out
+ flags: golib_unit,unit_tests
+ - name: Save Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
diff --git a/.github/workflows/go.unit.tests.yaml b/.github/workflows/go.unit.tests.yaml
deleted file mode 100644
index 2ec9967442..0000000000
--- a/.github/workflows/go.unit.tests.yaml
+++ /dev/null
@@ -1,219 +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.
-
-name: Go Unit Tests
-
-env:
- # alpine:3.13
- ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930
-
-on:
- push:
- paths:
- - .github/actions/go-test/**
- - .github/workflows/go.unit.tests.yaml
- - go.mod
- - go.sum
- - GO_VERSION
- - grove/**.go
- - lib/**.go
- - traffic_monitor/**.go
- - cache-config/t3c-generate/**.go
- - traffic_ops/traffic_ops_golang/**.go
- - traffic_stats/**.go
- - vendor/**.go
- - vendor/modules.txt
- create:
- pull_request:
- paths:
- - .github/actions/go-test/**
- - .github/workflows/go.unit.tests.yaml
- - go.mod
- - go.sum
- - GO_VERSION
- - grove/**.go
- - lib/**.go
- - traffic_monitor/**.go
- - cache-config/t3c-generate/**.go
- - traffic_ops/traffic_ops_golang/**.go
- - traffic_stats/**.go
- - vendor/**.go
- - vendor/modules.txt
- types: [opened, reopened, ready_for_review, synchronize]
-
-jobs:
- grove_unit_tests:
- if: github.event.pull_request.draft == false
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout
- uses: actions/checkout@master
- - name: Cache Alpine Docker image
- uses: actions/cache@v2
- with:
- path: ${{ github.workspace }}/docker-images
- key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
- - name: Import cached Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
- - name: Run Grove unit tests
- uses: ./.github/actions/go-test
- with:
- dir: ./grove/...
- test_name: grove
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
- with:
- files: grove-coverage.out
- flags: grove_unit
- - name: Save Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
-
- go_lib_unit_tests:
- if: github.event.pull_request.draft == false
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout
- uses: actions/checkout@master
- - name: Cache Alpine Docker image
- uses: actions/cache@v2
- with:
- path: ${{ github.workspace }}/docker-images
- key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
- - name: Import cached Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
- - name: Run Go Lib unit tests
- uses: ./.github/actions/go-test
- with:
- dir: ./lib/...
- test_name: golib
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
- with:
- files: golib-coverage.out
- flags: golib_unit
- - name: Save Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
-
- traffic_monitor_unit_tests:
- if: github.event.pull_request.draft == false
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout
- uses: actions/checkout@master
- - name: Cache Alpine Docker image
- uses: actions/cache@v2
- with:
- path: ${{ github.workspace }}/docker-images
- key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
- - name: Import cached Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
- - name: Run Traffic Monitor unit tests
- uses: ./.github/actions/go-test
- with:
- dir: ./traffic_monitor/...
- test_name: traffic_monitor
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
- with:
- files: traffic_monitor-coverage.out
- flags: traffic_monitor_unit
- - name: Save Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
-
- traffic_ops_unit_tests:
- if: github.event.pull_request.draft == false
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout
- uses: actions/checkout@master
- - name: Cache Alpine Docker image
- uses: actions/cache@v2
- with:
- path: ${{ github.workspace }}/docker-images
- key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
- - name: Import cached Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
- - name: Run Traffic Ops unit tests
- uses: ./.github/actions/go-test
- with:
- dir: ./traffic_ops/traffic_ops_golang/...
- test_name: traffic_ops
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
- with:
- files: traffic_ops-coverage.out
- flags: traffic_ops_unit
- - name: Save Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
-
- t3c_generate_unit_tests:
- if: github.event.pull_request.draft == false
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout
- uses: actions/checkout@master
- - name: Cache Alpine Docker image
- uses: actions/cache@v2
- with:
- path: ${{ github.workspace }}/docker-images
- key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
- - name: Import cached Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
- - name: Run T3C Generate unit tests
- uses: ./.github/actions/go-test
- with:
- dir: ./cache-config/t3c-generate/...
- test_name: t3c_generate
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
- with:
- files: t3c_generate-coverage.out
- flags: t3c_generate_unit
- - name: Save Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
-
- traffic_stats_unit_tests:
- if: github.event.pull_request.draft == false
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout
- uses: actions/checkout@master
- - name: Cache Alpine Docker image
- uses: actions/cache@v2
- with:
- path: ${{ github.workspace }}/docker-images
- key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
- - name: Import cached Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
- - name: Run Traffic Stats unit tests
- uses: ./.github/actions/go-test
- with:
- dir: ./traffic_stats/...
- test_name: traffic_stats
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v3
- with:
- files: traffic_stats-coverage.out
- flags: traffic_stats_unit
- - name: Save Alpine Docker image
- run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
diff --git a/.github/workflows/grove.unit.tests.yml b/.github/workflows/grove.unit.tests.yml
new file mode 100644
index 0000000000..5c400069ed
--- /dev/null
+++ b/.github/workflows/grove.unit.tests.yml
@@ -0,0 +1,72 @@
+# 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: Grove Unit Tests
+
+env:
+ # alpine:3.13
+ ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930
+
+on:
+ push:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/grove.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ create:
+ pull_request:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/grove.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ types: [opened, reopened, ready_for_review, synchronize]
+
+jobs:
+ grove_unit_tests:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ - name: Cache Alpine Docker image
+ uses: actions/cache@v2
+ with:
+ path: ${{ github.workspace }}/docker-images
+ key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
+ - name: Import cached Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
+ - name: Run Grove unit tests
+ uses: ./.github/actions/go-test
+ with:
+ dir: ./grove/...
+ test_name: grove
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: grove-coverage.out
+ flags: grove_unit,unit_tests
+ - name: Save Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
diff --git a/.github/workflows/tm.unit.tests.yml b/.github/workflows/tm.unit.tests.yml
new file mode 100644
index 0000000000..2156dd8fd0
--- /dev/null
+++ b/.github/workflows/tm.unit.tests.yml
@@ -0,0 +1,72 @@
+# 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 Monitor Unit Tests
+
+env:
+ # alpine:3.13
+ ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930
+
+on:
+ push:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/tm.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ create:
+ pull_request:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/tm.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ types: [opened, reopened, ready_for_review, synchronize]
+
+jobs:
+ traffic_monitor_unit_tests:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ - name: Cache Alpine Docker image
+ uses: actions/cache@v2
+ with:
+ path: ${{ github.workspace }}/docker-images
+ key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
+ - name: Import cached Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
+ - name: Run Traffic Monitor unit tests
+ uses: ./.github/actions/go-test
+ with:
+ dir: ./traffic_monitor/...
+ test_name: traffic_monitor
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: traffic_monitor-coverage.out
+ flags: traffic_monitor_unit,unit_tests
+ - name: Save Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
diff --git a/.github/workflows/traffic-ops.yml b/.github/workflows/to.integration.tests.yml
similarity index 98%
rename from .github/workflows/traffic-ops.yml
rename to .github/workflows/to.integration.tests.yml
index d3518133bf..2be60a5f1c 100644
--- a/.github/workflows/traffic-ops.yml
+++ b/.github/workflows/to.integration.tests.yml
@@ -27,7 +27,7 @@ on:
- .github/actions/todb-init/**
- .github/actions/tvdb-init/**
- .github/actions/to-integration-tests/**
- - .github/workflows/traffic-ops.yml
+ - .github/workflows/to.integration.tests.yml
- go.mod
- go.sum
- GO_VERSION
@@ -43,7 +43,7 @@ on:
- .github/actions/todb-init/**
- .github/actions/tvdb-init/**
- .github/actions/to-integration-tests/**
- - .github/workflows/traffic-ops.yml
+ - .github/workflows/to.integration.tests.yml
- go.mod
- go.sum
- GO_VERSION
diff --git a/.github/workflows/to.unit.tests.yml b/.github/workflows/to.unit.tests.yml
new file mode 100644
index 0000000000..e584b47e1a
--- /dev/null
+++ b/.github/workflows/to.unit.tests.yml
@@ -0,0 +1,72 @@
+# 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 Unit Tests
+
+env:
+ # alpine:3.13
+ ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930
+
+on:
+ push:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/to.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ create:
+ pull_request:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/to.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ types: [opened, reopened, ready_for_review, synchronize]
+
+jobs:
+ traffic_ops_unit_tests:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ - name: Cache Alpine Docker image
+ uses: actions/cache@v2
+ with:
+ path: ${{ github.workspace }}/docker-images
+ key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
+ - name: Import cached Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
+ - name: Run Traffic Ops unit tests
+ uses: ./.github/actions/go-test
+ with:
+ dir: ./traffic_ops/traffic_ops_golang/...
+ test_name: traffic_ops
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: traffic_ops-coverage.out
+ flags: traffic_ops_unit,unit_tests
+ - name: Save Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
diff --git a/.github/workflows/traffic-stats.unit.tests.yml b/.github/workflows/traffic-stats.unit.tests.yml
new file mode 100644
index 0000000000..b844a16aa2
--- /dev/null
+++ b/.github/workflows/traffic-stats.unit.tests.yml
@@ -0,0 +1,72 @@
+# 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 Stats Unit Tests
+
+env:
+ # alpine:3.13
+ ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930
+
+on:
+ push:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/traffic-stats.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ create:
+ pull_request:
+ paths:
+ - .github/actions/go-test/**
+ - .github/workflows/traffic-stats.unit.tests.yml
+ - go.mod
+ - go.sum
+ - GO_VERSION
+ - '**.go'
+ - vendor/modules.txt
+ types: [opened, reopened, ready_for_review, synchronize]
+
+jobs:
+ traffic_stats_unit_tests:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+ - name: Cache Alpine Docker image
+ uses: actions/cache@v2
+ with:
+ path: ${{ github.workspace }}/docker-images
+ key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
+ - name: Import cached Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
+ - name: Run Traffic Stats unit tests
+ uses: ./.github/actions/go-test
+ with:
+ dir: ./traffic_stats/...
+ test_name: traffic_stats
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: traffic_stats-coverage.out
+ flags: traffic_stats_unit,unit_tests
+ - name: Save Alpine Docker image
+ run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}
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 41a2dcfeab..5111047bae 100644
--- a/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
+++ b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
@@ -46,7 +46,7 @@ WORKDIR /go/src/github.com/apache/trafficcontrol/traffic_ops/testing/api
RUN go mod vendor -v
RUN set -o errexit -o xtrace;\
- for api_version in v3 v4; do\
+ for api_version in v{3..5}; do\
go test -c ./$api_version -ldflags="-w -s" -o traffic_ops_${api_version}_integration_test;\
done
@@ -71,9 +71,11 @@ 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/v3/tc-fixtures.json /opt/integration/app/tc-fixtures-v3.json
COPY ./traffic_ops/testing/api/v4/tc-fixtures.json /opt/integration/app/tc-fixtures-v4.json
+COPY ./traffic_ops/testing/api/v5/tc-fixtures.json /opt/integration/app/tc-fixtures-v5.json
COPY --from=integration-builder \
/go/src/github.com/apache/trafficcontrol/traffic_ops/testing/api/traffic_ops_v3_integration_test \
/go/src/github.com/apache/trafficcontrol/traffic_ops/testing/api/traffic_ops_v4_integration_test \
+ /go/src/github.com/apache/trafficcontrol/traffic_ops/testing/api/traffic_ops_v5_integration_test \
/opt/integration/app/
COPY --from=integration-builder \