Skip to content

Commit 23aa69b

Browse files
committed
overview
1 parent cf7ebd2 commit 23aa69b

File tree

3 files changed

+55
-16
lines changed

3 files changed

+55
-16
lines changed

cloudapp/app/app.py

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ def echo_html():
7878
}
7979
return render_template('pretty_echo.html', request_env=app.config['site'], info=info, request_headers=headers, request_data=data)
8080

81+
@app.route('/foo/', methods=['GET'])
82+
def ex_test():
83+
return jsonify({'info': 'bar'})
84+
8185
return app
8286

8387
app = create_app()

labapp/app/app.py

+21
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,27 @@ def score():
195195
ns=ns
196196
)
197197

198+
@app.route('/_test1')
199+
def ex_test():
200+
"""Example test"""
201+
try:
202+
url = f"https://foo.{app.config['base_url']}/"
203+
data = cloudapp_fetch(url, 5, 'info', 'bar')
204+
return jsonify(status='success', data=data)
205+
except (LabException, requests.RequestException, ValueError) as e:
206+
return jsonify(status='fail', error=str(e))
207+
208+
@app.route('/_test2')
209+
def ex_test():
210+
"""Example test"""
211+
try:
212+
url = f"https://bar.{app.config['base_url']}/"
213+
data = cloudapp_fetch(url, 5, 'info', 'foo')
214+
return jsonify(status='success', data=data)
215+
except (LabException, requests.RequestException, ValueError) as e:
216+
return jsonify(status='fail', error=str(e))
217+
218+
198219
@app.route('/_lb1')
199220
def lb_aws():
200221
"""Azure LB test"""

labapp/app/markdown/overview.md

+30-16
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,47 @@ Remember while working through the lab, unless otherwise noted, the tests are di
4545

4646
## **Lab Exercises**
4747

48-
To complete the lab exercises, you will interact with a load balancer advertised from the Customer Edge in your UDF site from the [lab app](https://github.com/f5devcentral/f5xc-lab-mcn-practical/tree/main/labapp).
48+
To complete the lab exercises, you will interact with a load balancer advertised from the Customer Edge in your UDF site.
49+
All requests will be made from this lab application.
4950

50-
Test button
5151

52+
#### **Test Criteria**
5253

54+
Exercises will specify thier success criteria.
5355

5456
```http
55-
GET https://eph-ns.mcn-lab.f5demos.com/ HTTP/1.1
56-
Host: eph-ns.mcn-lab.f5demos.com
57+
GET https://foo.f5demos.com/ HTTP/1.1
5758
5859
{
59-
"env": "Azure",
60-
"info": {
61-
"method": "GET",
62-
"path": "/",
63-
"url": "https://eph-ns.mcn-lab.f5demos.com"
64-
},
65-
"request_headers": {
66-
"Host": "https://eph-ns.mcn-lab.f5demos.com",
67-
"User-Agent": "curl/8.4.0",
68-
"X-Request-Id": "9cff4a3d-29e1-458e-b62e-3192e8398e14"
69-
}
60+
"info": "bar"
7061
}
7162
```
7263

64+
In this example, the exercise's test will make a request to <strong>https://foo.f5demos.com</strong>.
65+
The test will succeed if the response contains the ``JSON`` response ``{ "info": "bar" }``.
66+
67+
Here's an example test to try.
68+
69+
<div class="left-aligned-button-container">
70+
<button id="requestBtn1" class="btn btn-primary">Example Test</button>
71+
</div>
72+
<div id="result1" class="mt-3"></div>
73+
<script>
74+
document.getElementById('requestBtn1').addEventListener('click', () => {
75+
makeHttpRequest('requestBtn1', '/_test', 'result1');
76+
});
77+
</script>
78+
79+
#### **Other Tools**
80+
81+
``curl`` and ``jq`` are provided on the UDF "Runner" instance.
82+
83+
<img src="/static/curl.png" width="400px" height="auto" alt="curl">
84+
85+
86+
Note that responses displayed in exercise tests are truncated for readibility.
87+
7388

74-
``curl`` and ``jq`` are provided on the UDF "Runner" instance.
7589

7690
<div href="/" class="d-flex align-items-center pb-3 mb-3 link-dark text-decoration-none border-bottom"></div>
7791

0 commit comments

Comments
 (0)