How to avoid timeout after go test 10m

王林
Release: 2024-02-11 10:42:07
forward
826 people have browsed it

How to avoid timeout after go test 10m

php editor Strawberry brings you the answer to "How to avoid timeout after Go test for 10m". During the testing process of Go language, timeout problems are often encountered, especially when processing large amounts of data. This article will introduce some methods to avoid timeouts to help developers conduct better testing and improve code quality and efficiency. Whether you use timeout control, batch processing or optimization algorithms, you can effectively avoid timeout problems during the testing process and improve the stability and reliability of the program. Let’s take a look at the specific solutions!

Question content

I am currently using the go test ./... command to run a set of tests in Go. The suite contains multiple test functions that take more than 10 minutes to execute. Unfortunately, the go test command triggers a timeout error after the 10 minute mark.

I would like to avoid using the --timeout flag to set a custom timeout value because I am actively adding more test cases and the required timeout value may change over time.

Is there a way to completely disable the timeout feature in the go test command, or can it be set to an infinite value?

Thanks.

Workaround

Use 0 as the timeout to allow the test to run forever:

go test -timeout 0
Copy after login

This is documented in go command:test flags:

The above is the detailed content of How to avoid timeout after go test 10m. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!