Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
sfowl committed Nov 19, 2024
1 parent f85beb2 commit 4a77f0d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ repos:
args:
- --max-line-length=120
- --min-public-methods=0
- --good-names=w,q,f,fp,i,e
- --good-names=o,w,q,f,fp,i,e
- --disable=E0401,W1201,W1203,C0114,C0115,C0116,C0411,W0107,W0511,W0702,R0801,R1705,R1710
language_version: python3
Empty file added e2e-tests/__init__.py
Empty file.
25 changes: 13 additions & 12 deletions e2e-tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import tempfile
import time
from functools import partial
from typing import List, Tuple

import certifi
from kubernetes import client
Expand Down Expand Up @@ -40,19 +39,21 @@ def wait_until_ready(**kwargs):
time.sleep(2)
try:
pods = corev1.list_namespaced_pod(namespace=NAMESPACE, **kwargs)
if len(pods.items) != 1:
raise RuntimeError(f"Unexpected number of pods {len(pods.items)} matching: {kwargs}")
pod = pods.items[0]

# Check if pod is ready by looking at conditions
if pod.status.conditions:
for condition in pod.status.conditions:
if condition.type == "Ready":
logging.info(f"{pod.metadata.name} Ready={condition.status}")
if condition.status == "True":
return True
except client.ApiException as e:
logging.error(f"Error checking pod status: {e}")
return False

if len(pods.items) != 1:
raise RuntimeError(f"Unexpected number of pods {len(pods.items)} matching: {kwargs}")
pod = pods.items[0]

# Check if pod is ready by looking at conditions
if pod.status.conditions:
for condition in pod.status.conditions:
if condition.type == "Ready":
logging.info(f"{pod.metadata.name} Ready={condition.status}")
if condition.status == "True":
return True
return False


Expand Down
6 changes: 3 additions & 3 deletions e2e-tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import os
import re

from conftest import tee_log
from conftest import TestBase
from conftest import wait_until_ready
from conftest import tee_log # pylint: disable=E0611
from conftest import TestBase # pylint: disable=E0611
from conftest import wait_until_ready # pylint: disable=E0611


class TestRapiDAST(TestBase):
Expand Down
16 changes: 3 additions & 13 deletions e2e-tests/test_nessus.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os

from conftest import tee_log
from conftest import TestBase
from conftest import wait_until_ready
from conftest import tee_log # pylint: disable=E0611
from conftest import TestBase # pylint: disable=E0611
from conftest import wait_until_ready # pylint: disable=E0611


class TestNessus(TestBase):
Expand All @@ -18,13 +18,3 @@ def test_nessus(self):

logfile = os.path.join(self.tempdir, "rapidast-nessus.log")
tee_log("rapidast-nessus", logfile)

# # XXX relies on rapidast-vapi pod cat-ing the result json file after execution
# with open(logfile, "r", encoding="utf-8") as f:
# logs = f.read()
# pattern = r"^{\s*$.*$"
# matches = re.findall(pattern, logs, re.MULTILINE | re.DOTALL)
# assert matches, f"{logfile} did not contain expected json results"
# results = json.loads(matches[0])

# assert len(results["site"][0]["alerts"]) == 3

0 comments on commit 4a77f0d

Please sign in to comment.