ttrpc icon indicating copy to clipboard operation
ttrpc copied to clipboard

TestServerRequestTimeout is flaky on Windows

Open austinvazquez opened this issue 2 years ago • 2 comments

TestServerRequestTimeout has been intermittently failing in PRs due to differences in deadline comparisons.

Example output from a PR run

🇩 coverage
--- FAIL: TestServerRequestTimeout (0.01s)
    server_test.go:406: expected deadline 2023-02-25 00:20:34.5471163 +0000 GMT m=+601.181318201, actual: 1677284434547116900
FAIL
coverage: 64.8% of statements
FAIL	github.com/containerd/ttrpc	1.385s
FAIL
mingw32-make: *** [makefile:155: coverage] Error 1
Error: Process completed with exit code 1.

austinvazquez avatar Feb 25 '23 00:02 austinvazquez

After adding troubleshooting code, the error is the following from https://github.com/containerd/ttrpc/actions/runs/4368862651/jobs/7641979795

🇩 coverage
?   	github.com/containerd/ttrpc/internal	[no test files]
--- FAIL: TestServerRequestTimeout (0.02s)
    server_test.go:403: expected deadline 2023-03-08 22:07:26.763647 +0000 UTC m=+601.464964001, actual: 2023-03-08 22:07:26.7636471 +0000 UTC
FAIL
FAIL	github.com/containerd/ttrpc	1.723s
?   	github.com/containerd/ttrpc/plugin	[no test files]
FAIL
mingw32-make: *** [makefile:154: coverage] Error 1
Error: Process completed with exit code 1.

austinvazquez avatar Mar 08 '23 22:03 austinvazquez

After putting the expected and actual values in same format, it looks like the issue is off by 1 nanosecond. My read of Golang's context.Context interface is that successful calls to Deadline would result in consistent results. Is this possibly a Go bug on Windows?

austinvazquez avatar Mar 09 '23 00:03 austinvazquez