2020-06-04 13:42:09 +02:00
|
|
|
import datetime
|
|
|
|
import http.client
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
print("Waiting to run tests until PostHog is up and serving requests")
|
|
|
|
booted = False
|
|
|
|
ts = datetime.datetime.now()
|
|
|
|
while not booted and (datetime.datetime.now() - ts).seconds < 240:
|
|
|
|
try:
|
|
|
|
conn = http.client.HTTPConnection("127.0.0.1", 8000)
|
2020-09-07 16:23:13 +02:00
|
|
|
conn.request("GET", "/signup")
|
2020-06-04 13:42:09 +02:00
|
|
|
r = conn.getresponse()
|
|
|
|
if r.status == 200:
|
|
|
|
booted = True
|
|
|
|
print("PostHog is alive! Proceeding")
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
# recieved not 200 from PostHog, but service is up
|
2020-07-02 15:41:49 +02:00
|
|
|
print("Found status %d" % (r.status,))
|
|
|
|
with open("cypress/screenshots/curl.html", "wb") as f:
|
2021-12-10 09:29:04 +01:00
|
|
|
f.write(r.read) # type: ignore
|
2020-06-04 13:42:09 +02:00
|
|
|
print("PostHog is still booting. Sleeping for 1 second")
|
|
|
|
except:
|
|
|
|
print("PostHog is still booting. Sleeping for 1 second")
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|