|
26 | 26 | "rg_location = 'eastus2'\n", |
27 | 27 | "index = 1\n", |
28 | 28 | "apim_sku = APIM_SKU.BASICV2 # Options: 'BASICV2', 'STANDARDV2', 'PREMIUMV2'\n", |
29 | | - "deployment = INFRASTRUCTURE.AFD_APIM_PE\n", |
| 29 | + "deployment = INFRASTRUCTURE.AFD_APIM_PE # Options: see supported_infras below\n", |
30 | 30 | "api_prefix = 'template-' # ENTER A PREFIX FOR THE APIS TO REDUCE COLLISION POTENTIAL WITH OTHER SAMPLES\n", |
31 | 31 | "tags = ['tag1', 'tag2'] # ENTER DESCRIPTIVE TAGS\n", |
32 | 32 | "\n", |
|
56 | 56 | "# apis: List[API] = [api1, apin]\n", |
57 | 57 | "apis: List[API] = []\n", |
58 | 58 | "\n", |
59 | | - "print_okbook initialized')" |
| 59 | + "print_ok('Notebook initialized')" |
60 | 60 | ] |
61 | 61 | }, |
62 | 62 | { |
|
89 | 89 | " apim_gateway_url = output.get('apimResourceGatewayURL', 'APIM API Gateway URL')\n", |
90 | 90 | " apim_apis = output.getJson('apiOutputs', 'APIs')\n", |
91 | 91 | "\n", |
92 | | - " print_okoyment completed successfully')\n", |
| 92 | + " print_ok('Deployment completed successfully')\n", |
93 | 93 | "else:\n", |
94 | 94 | " print_error(\"Deployment failed!\")\n", |
95 | 95 | " raise SystemExit(1)" |
|
119 | 119 | "tests = ApimTesting(\"Template Sample Tests\", sample_folder, nb_helper.deployment)\n", |
120 | 120 | "\n", |
121 | 121 | "# Example API testing (uncomment and customize as needed)\n", |
122 | | - "# api_subscription_key = apim_apis[0]['subscriptionPrimaryKey']\n", |
| 122 | + "# Determine endpoints, URLs, etc. prior to test execution\n", |
| 123 | + "# endpoints = utils.get_endpoints(deployment, rg_name)\n", |
| 124 | + "# endpoint_url = None\n", |
| 125 | + "# request_headers = None\n", |
123 | 126 | "\n", |
124 | | - "# Preflight: Check if the infrastructure architecture deployment uses Azure Front Door. If so, assume that APIM is not directly accessible and use the Front Door URL instead.\n", |
125 | | - "# endpoint_url = utils.test_url_preflight_check(deployment, rg_name, apim_gateway_url)\n", |
| 127 | + "# if (endpoints.appgw_hostname and endpoints.appgw_public_ip):\n", |
| 128 | + "# endpoint_url = f'https://{endpoints.appgw_public_ip}'\n", |
| 129 | + "# request_headers: dict[str, str] = {\"Host\": endpoints.appgw_hostname}\n", |
| 130 | + "# else:\n", |
| 131 | + "# # Preflight: Check if the infrastructure architecture deployment uses Azure Front Door. If so, assume that APIM is not directly accessible and use the Front Door URL instead.\n", |
| 132 | + "# endpoint_url = utils.test_url_preflight_check(deployment, rg_name, apim_gateway_url)\n", |
| 133 | + "\n", |
| 134 | + "# ********** TEST EXECUTIONS **********\n", |
126 | 135 | "\n", |
127 | 136 | "# reqs = ApimRequests(afd_endpoint_url, api_subscription_key)\n", |
128 | 137 | "# output = reqs.singleGet('/', msg = 'Calling API via Azure Front Door. Expect 200.')\n", |
129 | 138 | "# tests.verify('expected_value' in output, True)\n", |
130 | 139 | "\n", |
131 | 140 | "tests.print_summary()\n", |
132 | 141 | "\n", |
133 | | - "print_okdone!')" |
| 142 | + "print_ok('All done!')" |
134 | 143 | ] |
135 | 144 | } |
136 | 145 | ], |
|
0 commit comments