Skip to content

Commit

Permalink
Added -O to overwrite secret creation. Added conditional around testi…
Browse files Browse the repository at this point in the history
…ng agbot status for only local tests

Signed-off-by: Ben Courliss <[email protected]>
  • Loading branch information
Ben Courliss committed Aug 18, 2021
1 parent ad45435 commit d80725b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
15 changes: 9 additions & 6 deletions test/gov/agbot_apitest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -585,11 +585,14 @@ echo "$CMD"
RES=$($CMD)
results "$RES" "200" "exists" "false"

# Check agbot <-> vault health status using AGBOT_API
echo -e "\n${PREFIX} Check agbot-vault health status"
CMD="curl -sLX GET -w %{http_code} ${AGBOT_API}/health"
echo "$CMD"
RES=$($CMD)
results "$RES" "200" "lastVaultInteraction"
# skip if not local e2edev test
if [ "${EXCH_APP_HOST}" == "http://exchange-api:8081/v1" ]; then
# Check agbot <-> vault health status using AGBOT_API
echo -e "\n${PREFIX} Check agbot-vault health status"
CMD="curl -sLX GET -w %{http_code} ${AGBOT_API}/health"
echo "$CMD"
RES=$($CMD)
results "$RES" "200" "lastVaultInteraction"
fi

echo -e "\n${PREFIX} complete test\n"
36 changes: 16 additions & 20 deletions test/gov/setup_secrets.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash
# First create the secret that the service will need

# if [ "${EXCH_APP_HOST}" != "http://exchange-api:8081/v1" ]; then
# exit 0
# fi

if [ "${NOVAULT}" == "1" ]
then
echo -e "Skipping secret setup"
Expand Down Expand Up @@ -42,9 +38,9 @@ export HZN_AGBOT_URL=${AGBOT_SAPI_URL}

# Create secrets in userdev org
echo -e "Create netspeed secret1"
CMD="hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE1} ${CREATE_ORG_SECRET1}"
CMD="hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE1} ${CREATE_ORG_SECRET1} -O"
echo "$CMD"
RES=$(hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE1} ${CREATE_ORG_SECRET1})
RES=$(hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE1} ${CREATE_ORG_SECRET1} -O)

# check for erroneous return
if [ $? -ne 0 ]; then
Expand All @@ -55,9 +51,9 @@ fi
echo "$RES"

echo -e "Create netspeed secret2"
CMD="hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET2}"
CMD="hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET2} -O"
echo "$CMD"
RES=$(hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET2})
RES=$(hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET2} -O)

# check for erroneous return
if [ $? -ne 0 ]; then
Expand All @@ -68,15 +64,15 @@ fi
echo "$RES"

echo -e "Create netspeed secret3"
CMD="hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET3}"
CMD="hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET3} -O"
echo "$CMD"
RES=$(hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET3})
RES=$(hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET3} -O)

# creating secrets for compcheck tests
echo -e "Create org secret sqltoken"
CMD="hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey sqltoken -d mysqltoken ${CREATE_ORG_SECRET4}"
CMD="hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey sqltoken -d mysqltoken ${CREATE_ORG_SECRET4} -O"
echo "$CMD"
RES=$(hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey sqltoken -d mysqltoken ${CREATE_ORG_SECRET4})
RES=$(hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey sqltoken -d mysqltoken ${CREATE_ORG_SECRET4} -O)

# check for erroneous return
if [ $? -ne 0 ]; then
Expand All @@ -92,14 +88,14 @@ E2EDEV_ORG="[email protected]"
E2EDEV_ADMIN_AUTH="[email protected]/e2edevadmin:e2edevadminpw"

echo -e "Create netspeed secret1"
CMD="hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE1} ${CREATE_ORG_SECRET1}"
CMD="hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE1} ${CREATE_ORG_SECRET1} -O"
echo "$CMD"
RES=$(hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE1} ${CREATE_ORG_SECRET1})
RES=$(hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE1} ${CREATE_ORG_SECRET1} -O)

echo -e "Create user secret aitoken"
CMD="hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey aitoken -d myaitoken ${CREATE_USER_SECRET5}"
CMD="hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey aitoken -d myaitoken ${CREATE_USER_SECRET5} -O"
echo "$CMD"
RES=$(hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey aitoken -d myaitoken ${CREATE_USER_SECRET5})
RES=$(hzn secretsmanager secret add -o ${USERDEV_ORG} -u ${USERDEV_ADMIN_AUTH} --secretKey aitoken -d myaitoken ${CREATE_USER_SECRET5} -O)

# check for erroneous return
if [ $? -ne 0 ]; then
Expand All @@ -110,9 +106,9 @@ fi
echo "$RES"

echo -e "Create netspeed secret2"
CMD="hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET2}"
CMD="hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET2} -O"
echo "$CMD"
RES=$(hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET2})
RES=$(hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET2} -O)

# check for erroneous return
if [ $? -ne 0 ]; then
Expand All @@ -123,9 +119,9 @@ fi
echo "$RES"

echo -e "Create netspeed secret3"
CMD="hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET3}"
CMD="hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET3} -O"
echo "$CMD"
RES=$(hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET3})
RES=$(hzn secretsmanager secret add -o ${E2EDEV_ORG} -u ${E2EDEV_ADMIN_AUTH} --secretKey ${ORG_SECRET_KEY} -d ${ORG_SECRET_VALUE2} ${CREATE_ORG_SECRET3} -O)

# check for erroneous return
if [ $? -ne 0 ]; then
Expand Down

0 comments on commit d80725b

Please sign in to comment.