containerd / ttrpc

GRPC for low-memory environments
Apache License 2.0
558 stars 80 forks source link

TestServerRequestTimeout is flaky on Windows #131

Open austinvazquez opened 1 year ago

austinvazquez commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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?