-
Notifications
You must be signed in to change notification settings - Fork 1.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
8 changed files
with
95 additions
and
35 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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
SAM CLI version | ||
""" | ||
|
||
__version__ = "1.57.0" | ||
__version__ = "1.58.0" |
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
Binary file not shown.
Binary file not shown.
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,33 @@ | ||
# Common utils between local tests | ||
import logging | ||
import random | ||
import time | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
START_WAIT_TIME_SECONDS = 60 | ||
|
||
|
||
class InvalidAddressException(Exception): | ||
pass | ||
|
||
|
||
def wait_for_local_process(process, port): | ||
start_time = time.time() | ||
while True: | ||
if time.time() - start_time > START_WAIT_TIME_SECONDS: | ||
# Couldn't match any output string during the max allowed wait time | ||
raise ValueError("Ran out of time attempting to start api/lambda process") | ||
line = process.stderr.readline() | ||
line_as_str = str(line.decode("utf-8")).strip() | ||
if line_as_str: | ||
LOG.info(f"{line_as_str}") | ||
if "Address already in use" in line_as_str: | ||
LOG.info(f"Attempted to start port on {port} but it is already in use, restarting on a new port.") | ||
raise InvalidAddressException() | ||
if "(Press CTRL+C to quit)" in line_as_str: | ||
break | ||
|
||
|
||
def random_port(): | ||
return random.randint(30000, 40000) |
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