TaylorCFrey commented on a change in pull request #5351:
URL: https://github.com/apache/trafficcontrol/pull/5351#discussion_r541149605



##########
File path: .github/actions/tp-e2e-tests/entrypoint.sh
##########
@@ -0,0 +1,208 @@
+#!/bin/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.
+
+fqdn="http://localhost:4444/wd/hub/status";
+if ! curl -Lvsk "${fqdn}" >/dev/null 2>&1; then
+  echo "Selenium not started on ${fqdn}"
+  exit 1
+fi
+
+DIVISION="adivision"
+REGION="aregion"
+PHYS="aloc"
+COORD="acoord"
+CDN="zcdn"
+CG="acg"
+
+<<QUERY psql -d postgresql://traffic_ops:twelve@localhost:5432/traffic_ops
+INSERT INTO tm_user (username, local_passwd, role, tenant_id) VALUES ('admin', 
'SCRYPT:16384:8:1:vVw4X6mhoEMQXVGB/ENaXJEcF4Hdq34t5N8lapIjDQEAS4hChfMJMzwwmHfXByqUtjmMemapOPsDQXG+BAX/hA==:vORiLhCm1EtEQJULvPFteKbAX2DgxanPhHdrYN8VzhZBNF81NRxxpo7ig720KcrjH1XFO6BUTDAYTSBGU9KO3Q==',
 1, 1);
+INSERT INTO division(name) VALUES('${DIVISION}');
+INSERT INTO region(name, division) VALUES('${REGION}', 1);
+INSERT INTO phys_location(name, short_name, region, address, city, state, zip) 
VALUES('${PHYS}', '${PHYS}', 1, 'some place idk', 'Denver', 'CO', '88888');
+INSERT INTO coordinate(name) VALUES('${COORD}');
+INSERT INTO cdn(name, domain_name) VALUES('${CDN}', 'infra.ciab.test');
+
+WITH TYPE AS (SELECT id FROM type WHERE name = 'TC_LOC')
+INSERT INTO cachegroup(name, short_name, type, coordinate)
+SELECT '${CG}', '${CG}', TYPE.id, 1
+FROM TYPE;
+
+WITH TYPE AS (SELECT id FROM type WHERE name = 'RIAK'),
+PROFILE AS (SELECT id FROM profile WHERE name = 'RIAK_ALL'),
+STATUS AS (SELECT id FROM status WHERE name = 'ONLINE'),
+PHYS AS (SELECT id FROM phys_location WHERE name = '${PHYS}'),
+CDN AS (SELECT id FROM cdn WHERE name = '${CDN}'),
+CG AS (SELECT id from cachegroup WHERE name = '${CG}')
+INSERT INTO server(host_name, domain_name, cachegroup, type, status, profile, 
phys_location, cdn_id)
+SELECT 'trafficvault', 'infra.ciab.test', CG.ID, TYPE.id, STATUS.id, 
PROFILE.id, PHYS.id, CDN.id
+FROM TYPE
+JOIN STATUS ON 1=1
+JOIN PROFILE ON 1=1
+JOIN PHYS ON 1=1
+JOIN CDN ON 1=1
+JOIN CG ON 1=1;
+QUERY
+
+
+download_go() {
+       . build/functions.sh
+       if verify_and_set_go_version; then
+               return
+       fi
+       go_version="$(cat "${GITHUB_WORKSPACE}/GO_VERSION")"
+       wget -O go.tar.gz 
"https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz"; --no-verbose
+       echo "Extracting Go ${go_version}..."
+       <<-'SUDO_COMMANDS' sudo sh
+               set -o errexit
+               go_dir="$(
+                       dirname "$(
+                               dirname "$(
+                                       realpath "$(
+                                               which go

Review comment:
       Ok. This is just a suggestion, something I came across and read a while 
back. It's something you probably never wanted to know or even cared about, and 
certainly not required to change or implement, but I found that I follow this 
now when I remember.
   
   [Why to _not_ use `which` and what to use 
then?](https://unix.stackexchange.com/a/85250)
   
   TLDR; Use `command -v` (or `-V`) instead of `which`.
   
   `¯\_(ツ)_/¯`




----------------------------------------------------------------
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:
[email protected]


Reply via email to