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

Requests to API endpoint fail only inside github action #2

Open
meetbryce opened this issue Nov 30, 2019 · 1 comment
Open

Requests to API endpoint fail only inside github action #2

meetbryce opened this issue Nov 30, 2019 · 1 comment

Comments

@meetbryce
Copy link

Have a very simple test that fails in github actions with a connection timeout.

Can't find anything about how to debug the issue, so resorting to posting an issue here.

def test_pulse_returns_200():
    r = requests.get("http://localhost:5000/pulse")
    assert r.status_code == 200

Error logs attached.
6_Test with pytest.txt

@cclauss
Copy link
Owner

cclauss commented Nov 30, 2019

Run https://github.com/cclauss/Ten-lines-or-less/blob/master/platform_info.py on you own computer and again inside a GitHub Action. Comparing the output, you will see that the GitHub action is not running on your local machine. So unless you have turned on a server process within that GitHub Action, there will be nothing listening on http://localhost:5000. If your GitHub Action has set up such a server process, be aware the GitHub may limit that container’s ability to receive or send external traffic.

Your code can detect if it is running inside a GitHub Action by looking for any of https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants