Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 13, 2025

Tests were failing due to DNS resolution attempts in isolated environments and untagged Selenium tests attempting to run in CI.

Changes

  • Mock DNS resolution in URL safety tests: rebuild_safe_url() validates URLs by resolving hostnames via socket.getaddrinfo(), which fails in isolated test environments. Added mock to return a public IP for test URLs.
@patch("website.utils.socket.getaddrinfo")
def test_rebuild_safe_url(self, mock_getaddrinfo):
    # Simulate successful DNS resolution to public IP
    mock_getaddrinfo.return_value = [(2, 1, 6, "", ("93.184.216.34", 0))]
    # ... test cases
  • Tag Selenium tests for exclusion: Added @tag("selenium", "slow") to MySeleniumTests class to prevent ChromeDriver download failures when tests run with --exclude-tag=selenium.

All 305 tests now pass.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.openai.com
    • Triggering command: /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python manage.py test --failfast --exclude-tag=selenium (dns block)
    • Triggering command: /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python manage.py test --failfast --exclude-tag=selenium get --local y rt site import sbash (dns block)
  • example.com
    • Triggering command: /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python manage.py test --failfast --exclude-tag=selenium (dns block)
    • Triggering command: /usr/bin/python3 python3 (dns block)
    • Triggering command: /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python manage.py test website.tests.test_api.RebuildSafeUrlTestCase.test_rebuild_safe_url --failfast (dns block)
  • googlechromelabs.github.io
    • Triggering command: /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python manage.py test --failfast --exclude-tag=selenium (dns block)
  • https://api.github.com/repos/TestOrg/TestRepo/issues/123/comments
    • Triggering command: /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python manage.py test --failfast --exclude-tag=selenium (http block)
    • Triggering command: /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python manage.py test --failfast --exclude-tag=selenium get --local y rt site import sbash (http block)
  • https://api.github.com/repos/TestOrg/TestRepo/issues/123/labels
    • Triggering command: /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python manage.py test --failfast --exclude-tag=selenium (http block)
    • Triggering command: /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python /home/REDACTED/.cache/pypoetry/virtualenvs/blt-yuw0N2NF-py3.12/bin/python manage.py test --failfast --exclude-tag=selenium get --local y rt site import sbash (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Please fix the tests on the main branch


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 13, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 13, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 2 commits December 13, 2025 12:02
Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com>
Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix tests on the main branch Fix test failures: mock DNS resolution and tag Selenium tests Dec 13, 2025
Copilot AI requested a review from DonnieBLT December 13, 2025 12:10
@DonnieBLT DonnieBLT marked this pull request as ready for review December 14, 2025 00:28
Copilot AI review requested due to automatic review settings December 14, 2025 00:28
@github-actions github-actions bot added the files-changed: 2 PR changes 2 files label Dec 14, 2025
@github-actions github-actions bot added the pre-commit: passed Pre-commit checks passed label Dec 14, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes test failures that occur in isolated environments by mocking DNS resolution and properly tagging Selenium tests for exclusion from the main CI pipeline. The changes ensure all 305 tests can pass without requiring network access or ChromeDriver installation during CI runs.

Key Changes:

  • Added DNS resolution mocking to rebuild_safe_url tests to prevent failures when socket.getaddrinfo() is blocked in isolated test environments
  • Tagged Selenium test class with @tag("selenium", "slow") to enable exclusion via --exclude-tag=selenium flag

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
website/tests/test_api.py Added @patch decorator to mock socket.getaddrinfo in test_rebuild_safe_url, returning a public IP address (93.184.216.34) to simulate successful DNS resolution for example.com
website/tests/test_main.py Added tag import from django.test and applied @tag("selenium", "slow") decorator to MySeleniumTests class to prevent ChromeDriver-related failures in CI

@github-actions github-actions bot added last-active: 0d PR last updated 0 days ago tests: passed Django tests passed labels Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 2 PR changes 2 files last-active: 0d PR last updated 0 days ago pre-commit: passed Pre-commit checks passed tests: passed Django tests passed

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants