github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/tests/suites/magma/magma.sh (about) 1 # Ensure that Magma Orchestrator deploys successfully. 2 run_deploy_magma() { 3 echo 4 5 local name model_name file overlay_path cert_password nms_ip admin_username 6 name="deploy-magma" 7 model_name="${name}" 8 file="${TEST_DIR}/${model_name}.log" 9 10 ensure "${model_name}" "${file}" 11 12 echo "Deploy Magma project" 13 overlay_path="./tests/suites/magma/overlay/overlay.yaml" 14 juju deploy magma-orc8r --overlay "${overlay_path}" --trust --channel=beta 15 16 echo "Check all Magma project components have ACTIVE status" 17 # Magical number 34 means that all 34 apps from the magma bundle has the same status 18 wait_for 34 '[.applications[] | select(."application-status".current == "active")] | length' 3600 19 20 echo "Get cert file and request password for it" 21 juju scp --container="magma-orc8r-certifier" orc8r-certifier/0:/var/opt/magma/certs/admin_operator.pfx "${TEST_DIR}/admin_operator.pfx" 22 cert_password=$(juju run orc8r-certifier/leader get-pfx-package-password --wait --format=json | jq -r '."unit-orc8r-certifier-0".results.password') 23 24 echo "Get IP address of NMS nginx proxy" 25 nms_ip=$(juju run orc8r-orchestrator/leader get-load-balancer-services --wait --format=json | jq -r '."unit-orc8r-orchestrator-0".results."nginx-proxy"') 26 27 echo "Try to get access to Magma web interface via cert" 28 curl --insecure -s --cert-type P12 --cert "${TEST_DIR}"/admin_operator.pfx:"${cert_password}" https://"${nms_ip}":443 | jq -r ".errorCode" | check "USER_NOT_LOGGED_IN" 29 30 echo "Get NMS admin username" 31 admin_username=$(juju run nms-magmalte/leader get-master-admin-credentials --wait --format=json | jq -r '."unit-nms-magmalte-0".results."admin-username"') 32 echo "${admin_username}" | check "admin@juju.com" 33 34 } 35 36 test_deploy_magma() { 37 if [ "$(skip 'test_deploy_magma')" ]; then 38 echo "==> TEST SKIPPED: Test Deploy Magma" 39 return 40 fi 41 42 ( 43 set_verbosity 44 45 cd .. || exit 46 47 run "run_deploy_magma" 48 ) 49 }