Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add review_requested as a trigger & increased timeouts for camouflage #1200

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/project_automation_set_in_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
pull_request_target:
# Run this action when a PR is opened or edited
# Issues do not have a graphQL connection to linked PRs so we can't use that event
types: [ready_for_review]
types: [ready_for_review, review_requested]

env:
ORG: ${{ github.event.repository.owner.login }}
Expand Down
19 changes: 12 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def disable_gc():
gc.enable()


def wait_for_camouflage(host="localhost", port=8000, timeout=5):
def wait_for_camouflage(host="localhost", port=8000, timeout=10):

start_time = time.time()
cur_time = start_time
Expand All @@ -526,7 +526,7 @@ def wait_for_camouflage(host="localhost", port=8000, timeout=5):
url = f"http://{host}:{port}/ping"

while cur_time - start_time <= timeout:
timeout_epoch = min(cur_time + 1.0, end_time)
timeout_epoch = min(cur_time + 2.0, end_time)

try:
request_timeout = max(timeout_epoch - cur_time, 0.1)
Expand Down Expand Up @@ -568,7 +568,7 @@ def _start_camouflage(root_dir: str,
host: str = "localhost",
port: int = 8000) -> typing.Tuple[bool, typing.Optional[subprocess.Popen]]:
logger = logging.getLogger(f"morpheus.{__name__}")
startup_timeout = 5
startup_timeout = 10

launch_camouflage = os.environ.get('MORPHEUS_NO_LAUNCH_CAMOUFLAGE') is None
is_running = False
Expand Down Expand Up @@ -596,14 +596,19 @@ def _start_camouflage(root_dir: str,

logger.info("Launched camouflage in %s with pid: %s", root_dir, popen.pid)

def read_logs():
camouflage_log = os.path.join(root_dir, 'camouflage.log')
if os.path.exists(camouflage_log):
with open(camouflage_log, 'r', encoding='utf-8') as f:
return f.read()
return ""

if not wait_for_camouflage(host=host, port=port, timeout=startup_timeout):

if popen.poll() is not None:
camouflage_log = os.path.join(root_dir, 'camouflage.log')
raise RuntimeError(
f"camouflage server exited with status code={popen.poll()} details in: {camouflage_log}")
raise RuntimeError(f"camouflage server exited with status code={popen.poll()}\n{read_logs()}")

raise RuntimeError("Failed to launch camouflage server")
raise RuntimeError(f"Failed to launch camouflage server\n{read_logs()}")

# Must have been started by this point
return (True, popen)
Expand Down