docs404 Test Fails when Hugo Not Running
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 1.2k
- Avg merge
- 9m
- Merged PRs (30d)
- 1
Description
The script `ci/scripts/docs404.sh` doesn't check whether Hugo had been running prior to actual test. This cause Travis CI test fails on random PRs, with symptoms logged like (taken from [Travis log](https://travis-ci.org/linode/docs/jobs/612238062?utm_medium=notification&utm_source=github_status) for #2891):
```
2019-11-15 06:28:11 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2019-11-15 06:28:11 [scrapy.extensions.telnet] DEBUG: Telnet console listening on 127.0.0.1:6023
2019-11-15 06:28:11 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying (failed 1 times): Connection was refused by other side: 111: Connection refused.
2019-11-15 06:28:11 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying (failed 1 times): Connection was refused by other side: 111: Connection refused.
2019-11-15 06:28:11 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying (failed 2 times): Connection was refused by other side: 111: Connection refused.
2019-11-15 06:28:11 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying (failed 2 times): Connection was refused by other side: 111: Connection refused.
2019-11-15 06:28:12 [scrapy.downloadermiddlewares.retry] DEBUG: Gave up retrying (failed 3 times): Connection was refused by other side: 111: Connection refused.
2019-11-15 06:28:12 [scrapy.downloadermiddlewares.retry] DEBUG: Gave up retrying (failed 3 times): Connection was refused by other side: 111: Connection refused.
2019-11-15 06:28:12 [scrapy.core.scraper] ERROR: Error downloading
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/scrapy/core/downloader/middleware.py", line 43, in process_request
defer.returnValue((yield download_func(request=request,spider=spider)))
twisted.internet.error.ConnectionRefusedError: Connection was refused by other side: 111: Connection refused.
2019-11-15 06:28:12 [scrapy.core.scraper] ERROR: Error downloading
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/scrapy/core/downloader/middleware.py", line 43, in process_request
defer.returnValue((yield download_func(request=request,spider=spider)))
twisted.internet.error.ConnectionRefusedError: Connection was refused by other side: 111: Connection refused.
2019-11-15 06:28:12 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{'downloader/exception_count': 6,
'downloader/exception_type_count/twisted.internet.error.ConnectionRefusedError': 6,
'downloader/request_bytes': 1170,
'downloader/request_count': 6,
'downloader/request_method_count/GET': 6,
'finish_reason': 'finished',
'finish_time': datetime.datetime(2019, 11, 15, 6, 28, 12, 266530),
'log_count/DEBUG': 7,
'log_count/ERROR': 2,
'log_count/INFO': 2,
'memusage/max': 53145600,
'memusage/startup': 53145600,
'retry/count': 4,
'retry/max_reached': 2,
'retry/reason_count/twisted.internet.error.ConnectionRefusedError': 4,
'scheduler/dequeued': 6,
'scheduler/dequeued/memory': 6,
'scheduler/enqueued': 6,
'scheduler/enqueued/memory': 6,
'start_time': datetime.datetime(2019, 11, 15, 6, 28, 11, 76552)}
2019-11-15 06:28:12 [urllib3.connectionpool] DEBUG: Starting new HTTP connection (1): localhost:1313
Hugo server not running on port 1313
The command "./ci/scripts/$TEST_SUITE.sh" exited with 1.
```
Currently the workaround is pushing additional commits to PR, (hoping that) Hugo will run in the CI.
## Suggested Fix
Add check if Hugo was running. This ideally should be placed before `scrapy` invocation. Perhaps the check can be done by using `curl http://localhost:1313`. If `curl` return error, attempt to `hugo server`.
PS: Other means for checking Hugo runs are welcome.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ci/scripts/docs404.sh and inspect the Hugo and scrapy invocation order. Reproduce the localhost:1313 failure, then use the issue's curl-based check as a starting point for ensuring Hugo is available before scrapy runs. Done means docs404 no longer fails solely because Hugo was not running.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- hugo, shell
- Domain
- ci-cd, documentation, testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100