Skip to content

Commit

Permalink
overview
Browse files Browse the repository at this point in the history
  • Loading branch information
kreynoldsf5 committed May 1, 2024
1 parent cf7ebd2 commit 23aa69b
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 16 deletions.
4 changes: 4 additions & 0 deletions cloudapp/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def echo_html():
}
return render_template('pretty_echo.html', request_env=app.config['site'], info=info, request_headers=headers, request_data=data)

@app.route('/foo/', methods=['GET'])
def ex_test():
return jsonify({'info': 'bar'})

return app

app = create_app()
Expand Down
21 changes: 21 additions & 0 deletions labapp/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,27 @@ def score():
ns=ns
)

@app.route('/_test1')
def ex_test():
"""Example test"""
try:
url = f"https://foo.{app.config['base_url']}/"
data = cloudapp_fetch(url, 5, 'info', 'bar')
return jsonify(status='success', data=data)
except (LabException, requests.RequestException, ValueError) as e:
return jsonify(status='fail', error=str(e))

@app.route('/_test2')
def ex_test():
"""Example test"""
try:
url = f"https://bar.{app.config['base_url']}/"
data = cloudapp_fetch(url, 5, 'info', 'foo')
return jsonify(status='success', data=data)
except (LabException, requests.RequestException, ValueError) as e:
return jsonify(status='fail', error=str(e))


@app.route('/_lb1')
def lb_aws():
"""Azure LB test"""
Expand Down
46 changes: 30 additions & 16 deletions labapp/app/markdown/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,47 @@ Remember while working through the lab, unless otherwise noted, the tests are di

## **Lab Exercises**

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).
To complete the lab exercises, you will interact with a load balancer advertised from the Customer Edge in your UDF site.
All requests will be made from this lab application.

Test button

#### **Test Criteria**

Exercises will specify thier success criteria.

```http
GET https://eph-ns.mcn-lab.f5demos.com/ HTTP/1.1
Host: eph-ns.mcn-lab.f5demos.com
GET https://foo.f5demos.com/ HTTP/1.1
{
"env": "Azure",
"info": {
"method": "GET",
"path": "/",
"url": "https://eph-ns.mcn-lab.f5demos.com"
},
"request_headers": {
"Host": "https://eph-ns.mcn-lab.f5demos.com",
"User-Agent": "curl/8.4.0",
"X-Request-Id": "9cff4a3d-29e1-458e-b62e-3192e8398e14"
}
"info": "bar"
}
```

In this example, the exercise's test will make a request to <strong>https://foo.f5demos.com</strong>.
The test will succeed if the response contains the ``JSON`` response ``{ "info": "bar" }``.

Here's an example test to try.

<div class="left-aligned-button-container">
<button id="requestBtn1" class="btn btn-primary">Example Test</button>
</div>
<div id="result1" class="mt-3"></div>
<script>
document.getElementById('requestBtn1').addEventListener('click', () => {
makeHttpRequest('requestBtn1', '/_test', 'result1');
});
</script>

#### **Other Tools**

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

<img src="/static/curl.png" width="400px" height="auto" alt="curl">


Note that responses displayed in exercise tests are truncated for readibility.


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

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

Expand Down

0 comments on commit 23aa69b

Please sign in to comment.