Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement hs-lib@repl test as integration_test #1692

Merged
merged 10 commits into from
Feb 15, 2022
Merged

Conversation

k1nkreet
Copy link
Contributor

@k1nkreet k1nkreet commented Feb 10, 2022

Since #1645 is merged we can gradually implement integration tests from RunTests.hs as integration_test rules. Here we have hs-lib@repl test scenario reimplemented this way

@aherrmann
Copy link
Member

@k1nkreet It looks like CI is failing with a couple instances of

       ERROR: The Build Event Protocol upload failed: All retry attempts failed. DEADLINE_EXCEEDED: DEADLINE_EXCEEDED: deadline exceeded after 14.999828601s. [remote_addr=cloud.buildbuddy.io/34.82.173.239:443] DEADLINE_EXCEEDED: DEADLINE_EXCEEDED: deadline exceeded after 14.999828601s. [remote_addr=cloud.buildbuddy.io/34.82.173.239:443]`

Maybe worth asking on BuildBuddy Slack for some help.

@k1nkreet
Copy link
Contributor Author

k1nkreet commented Feb 11, 2022

There was a discussion on the BuildBuddy slack about month ago about exactly the same issue occurred when "running multiple bazel invocations one after the other in github actions". Here is the fixes proposed in the thread:

If so running either bazel shutdown before the command - or setting the flag --keep_backend_build_event_connections_alive=false  would likely help

Another thing that might help (that I've seen fix other github actions related networking issues) is running this before the invocation in your github action:
sudo sysctl -w net.ipv4.tcp_keepalive_time=60

Either that or setting the --keep_backend_build_event_connections_alive=false Bazel flag are two options I'd try out.

And for the question "is --keep_backend_build_event_connections_alive=false affects builds performance" the answer was given:

Pretty much no impact - just starts a new BES connection on the second invocation instead of trying to reuse the old one. Just a one time thing and not super expensive.

@aherrmann
Copy link
Member

@k1nkreet Thank you for digging into this. Yes, either option is worth a shot.

@k1nkreet
Copy link
Contributor Author

https://github.com/tweag/rules_haskell/blob/master/.bazelrc#L67

It looks like we've already tried to fix exactly same problem with the second solution :)

@@ -50,6 +50,7 @@ jobs:
nix-shell --arg docTools false --pure --run '
set -euo pipefail
./tests/run-start-script.sh --use-nix
bazel shutdown
bazel build //tests:run-tests
./bazel-ci-bin/tests/run-tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue might be that tests/run-tests runs a couple Bazel commands as well.

@k1nkreet
Copy link
Contributor Author

I've found out this test wasn't supposed to be passing on macos-bindist because hs-lib depend on c2hs target and tagged with dont_test_on_darwin_with_bindist. So I've used this tag for hs_lib_repl_test integration test as well.

Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, thank you!
A couple minor comments. Feel free to merge once addressed.

@@ -29,6 +29,7 @@ jobs:
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
run: |
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
# See https://github.com/tweag/rules_haskell/issues/1498 and https://github.com/tweag/rules_haskell/pull/1692.
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60

@@ -77,6 +78,7 @@ jobs:
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
run: |
sudo sysctl -w net.ipv4.tcp_keepalive_time=60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sudo sysctl -w net.ipv4.tcp_keepalive_time=60
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
# See https://github.com/tweag/rules_haskell/issues/1498 and https://github.com/tweag/rules_haskell/pull/1692.
sudo sysctl -w net.ipv4.tcp_keepalive_time=60

@@ -121,6 +123,7 @@ jobs:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
shell: bash
run: |
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60
# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`.
# See https://github.com/tweag/rules_haskell/issues/1498 and https://github.com/tweag/rules_haskell/pull/1692.
[[ ${{ runner.os }} == Linux ]] && sudo sysctl -w net.ipv4.tcp_keepalive_time=60

},
local_snapshot = "@rules_haskell//:stackage_snapshot.yaml",
packages = [
"array",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Looks like there is some inconsistent indentation.

],
},
local_snapshot = "@rules_haskell//:stackage_snapshot.yaml",
packages = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need all these packages, or could this be slimmed down a bit?

func TestMain(m *testing.M) {
it.TestMain(m, `
-- WORKSPACE --
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps some of this boilerplate could be factored out?
Doesn't have to be in this PR, but, once we see what's common across these tests, it would make sense to factor that out.

@k1nkreet k1nkreet merged commit f53c6f0 into master Feb 15, 2022
@k1nkreet k1nkreet deleted the ip/hs-lib-go-bazel-test branch February 15, 2022 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants