0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/cypress/wait.py

32 lines
1023 B
Python
Raw Normal View History

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)
conn.request("GET", "/signup")
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
print("Found status %d" % (r.status,))
with open("cypress/screenshots/curl.html", "wb") as f:
Cache yarn builds to speed up end to end testing (#927) * Cache yarn builds to speed up end to end testing * refine configs a bit * map port to localhost for redis and postgres * background posthog so we can proceed to next step * test debug=1 * debug back to false * block on posthog boot for debug * back to single boot posthog step * check response from login url * see if this is ssl redirect * more debugging around wait * print out redirect to see where it is going * print redirect location from header * this is so tedius * hit setup_admin url * ok, so we know it's 500-ing let's see what response is * reflect production docker file more closely for dep building * posthog is up, let's see what it is returning that is causing failures * Save screenshots as artifacts * rename artifact and use zip * demo is missing? * only upload artifacts if cypress fails * use the path for screenshots for artifacts * clean up wait script and call it done for this PR * correctly hash requirements for pip cache * cache build and dep separately for yarn * change to test the cache * use cypress suggested runner for actions * use parallel execution for cypress * skip python caching for now * not going to use parallel now because premium feature of cypress * do not attempt to archive video artifacts * re-enable pip cache 🤞 * bust the python cache and see if we can't get manage working * test python cache * it's just caching the pip cache... * test turning DEBUG false * reenable debug mode for now * collectstatic after yarn build * run collectstatic with noinput
2020-06-06 19:13:09 +02:00
f.write(r.read)
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()