You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2020/08/12 20:25:52 UTC

[GitHub] [trafficcontrol] zrhoffman commented on a change in pull request #4948: Unit test checks

zrhoffman commented on a change in pull request #4948:
URL: https://github.com/apache/trafficcontrol/pull/4948#discussion_r469471211



##########
File path: .github/actions/go-test/Dockerfile
##########
@@ -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.
+
+FROM golang:1.14

Review comment:
       This should be the exact go version that we require to build ATC (1.14.2 currently)

##########
File path: .github/actions/go-test/entrypoint.sh
##########
@@ -0,0 +1,35 @@
+#!/bin/sh -l

Review comment:
       Does the script need to run in a login shell?

##########
File path: .github/workflows/go.unit.tests.yaml
##########
@@ -0,0 +1,48 @@
+# 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
+
+on:
+  push:
+    paths:
+      - grove/**.go
+      - lib/**.go
+      - traffic_monitor/**.go
+      - traffic_ops/traffic_ops_golang/**.go
+      - traffic_ops_ort/atstccfg/**.go
+  create:
+  pull_request:
+    paths:
+      - grove/**.go
+      - lib/**.go
+      - traffic_monitor/**.go
+      - traffic_ops/traffic_ops_golang/**.go
+      - traffic_ops_ort/atstccfg/**.go

Review comment:
       This should include Traffic Stats sources, too

##########
File path: .github/workflows/go.unit.tests.yaml
##########
@@ -0,0 +1,48 @@
+# 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
+
+on:
+  push:
+    paths:
+      - grove/**.go
+      - lib/**.go
+      - traffic_monitor/**.go
+      - traffic_ops/traffic_ops_golang/**.go
+      - traffic_ops_ort/atstccfg/**.go

Review comment:
       This should include Traffic Stats sources

##########
File path: .github/workflows/go.unit.tests.yaml
##########
@@ -0,0 +1,48 @@
+# 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
+
+on:
+  push:
+    paths:
+      - grove/**.go
+      - lib/**.go
+      - traffic_monitor/**.go
+      - traffic_ops/traffic_ops_golang/**.go
+      - traffic_ops_ort/atstccfg/**.go
+  create:
+  pull_request:
+    paths:
+      - grove/**.go
+      - lib/**.go
+      - traffic_monitor/**.go
+      - traffic_ops/traffic_ops_golang/**.go
+      - traffic_ops_ort/atstccfg/**.go
+    types: [opened, reopened, edited, synchronize]
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+
+    steps:
+    - name: Checkout
+      uses: actions/checkout@master
+    - name: Run unit tests
+      uses: ./.github/actions/go-test
+      with:
+        dir: ./grove/... ./lib/... ./traffic_monitor/... ./traffic_ops/traffic_ops_golang/... ./traffic_ops_ort/atstccfg/...

Review comment:
       Needs to include Traffic Stats

##########
File path: .github/actions/go-test/entrypoint.sh
##########
@@ -0,0 +1,35 @@
+#!/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
+
+if [ -z "$INPUT_DIR" ]; then
+	# There's a bug in "defaults" for inputs
+	INPUT_DIR="./lib/..."
+fi
+
+GOPATH="$(mktemp -d)"
+SRCDIR="$GOPATH/src/github.com/apache"
+mkdir -p "$SRCDIR"
+ln -s "$PWD" "$SRCDIR/trafficcontrol"
+cd "$SRCDIR/trafficcontrol"
+
+# Need to fetch golang.org/x/* dependencies
+/usr/local/go/bin/go get -v $INPUT_DIR
+/usr/local/go/bin/go test -v $INPUT_DIR
+exit $?

Review comment:
       Is `exit $?` necessary? The exit code isn't printed either way.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org