-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
98 changed files
with
6,877 additions
and
5,222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,10 @@ jobs: | |
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
only-new-issues: true | ||
|
||
lint-python: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: isort/[email protected] | ||
- uses: psf/black@stable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,33 @@ | ||
import yaml, os | ||
from locust import TaskSet, HttpUser, task | ||
import os | ||
|
||
import yaml | ||
from locust import HttpUser, TaskSet, task | ||
|
||
host = "" | ||
|
||
|
||
class TestAPResponse(HttpUser): | ||
# locust class to be invoked | ||
# locust class to be invoked | ||
def on_start(self): | ||
# get host from appprotect-ingress yaml before each test | ||
# get host from appprotect-ingress yaml before each test | ||
ap_yaml = os.path.join(os.path.dirname(__file__), "../data/appprotect-ingress.yaml") | ||
with open(ap_yaml) as f: | ||
docs = yaml.safe_load_all(f) | ||
for dep in docs: | ||
self.host = dep['spec']['rules'][0]['host'] | ||
self.host = dep["spec"]["rules"][0]["host"] | ||
print("Setup finished") | ||
|
||
@task | ||
def send_block_request(self): | ||
# Send invalid request while dataguard alarm policy is active | ||
response = self.client.get( | ||
url="/<script>", | ||
headers={"host": self.host}, | ||
verify=False) | ||
# Send invalid request while dataguard alarm policy is active | ||
response = self.client.get(url="/<script>", headers={"host": self.host}, verify=False) | ||
print(response.text) | ||
|
||
@task | ||
def send_allow_request(self): | ||
# Send valid request while dataguard alarm policy is active | ||
response = self.client.get( | ||
url="", | ||
headers={"host": self.host}, | ||
verify=False) | ||
# Send valid request while dataguard alarm policy is active | ||
response = self.client.get(url="", headers={"host": self.host}, verify=False) | ||
print(response.text) | ||
|
||
min_wait = 400 | ||
max_wait = 1400 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[tool.black] | ||
line-length = 120 | ||
target-version = ['py310'] | ||
extend-exclude = '.*pb2.*' | ||
|
||
[tool.isort] | ||
atomic = true | ||
profile = "black" | ||
line_length = 120 | ||
skip_gitignore = true | ||
balanced_wrapping = true | ||
filter_files = true | ||
skip_glob = ['*pb2*'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.