From dfd14bd58911f0b780ed9fac59874ced517d90f4 Mon Sep 17 00:00:00 2001 From: roblabla Date: Thu, 1 Sep 2022 17:03:23 +0200 Subject: [PATCH] buf: Patch out flakey test --- pkgs/development/tools/buf/default.nix | 4 ++++ .../skip_test_invalid_upstream_flakey.patch | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/development/tools/buf/skip_test_invalid_upstream_flakey.patch diff --git a/pkgs/development/tools/buf/default.nix b/pkgs/development/tools/buf/default.nix index aae1c7af173b..95d919155cc6 100644 --- a/pkgs/development/tools/buf/default.nix +++ b/pkgs/development/tools/buf/default.nix @@ -26,6 +26,10 @@ buildGoModule rec { ./skip_test_requiring_network.patch # Skip TestWorkspaceGit which requires .git and commits. ./skip_test_requiring_dotgit.patch + # Skips the invalid_upstream test as it is flakey. Based on upstream commit + # 27930caf2eb35c2592a77f59ed5afe4d9e2fb7ea. + # This patch may be removed on the next buf update. + ./skip_test_invalid_upstream_flakey.patch ]; nativeBuildInputs = [ installShellFiles ]; diff --git a/pkgs/development/tools/buf/skip_test_invalid_upstream_flakey.patch b/pkgs/development/tools/buf/skip_test_invalid_upstream_flakey.patch new file mode 100644 index 000000000000..db62f6a40260 --- /dev/null +++ b/pkgs/development/tools/buf/skip_test_invalid_upstream_flakey.patch @@ -0,0 +1,24 @@ +diff --git a/private/bufpkg/bufstudioagent/bufstudioagent_test.go b/private/bufpkg/bufstudioagent/bufstudioagent_test.go +index 6e010937..9cacc082 100644 +--- a/private/bufpkg/bufstudioagent/bufstudioagent_test.go ++++ b/private/bufpkg/bufstudioagent/bufstudioagent_test.go +@@ -186,6 +186,19 @@ func testPlainPostHandlerErrors(t *testing.T, upstreamServer *httptest.Server) { + }) + + t.Run("invalid_upstream", func(t *testing.T) { ++ // TODO: unskip this test. This is flaky because of two reasons: ++ // ++ // 1. When a connection is closed, the underlying HTTP client does not ++ // always knows it, since the http handler implementation in go has no way ++ // of changing the connection timeout. See: ++ // https://github.com/golang/go/issues/16100 ++ // ++ // 2. The expected status code is `StatusBadGateway` since the issue ++ // happened client-side (a response never came back from the server). This ++ // is not deterministic in the business logic because we're based on the ++ // connect error code that's returned. See ++ // https://linear.app/bufbuild/issue/BSR-383/flaky-test-in-bufstudioagent-testgo ++ t.SkipNow() + listener, err := net.Listen("tcp", "127.0.0.1:") + require.NoError(t, err) + go func() {