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

Change integration tests implementation to one based on rules_bazel_integration_test #1766

Merged
merged 21 commits into from Jul 7, 2022

Conversation

k1nkreet
Copy link
Contributor

This PR suggests alternative approach to integration testing, based on rules_bazel_integration_test ruleset. Unfortunately I could not come up with anything less radical than put all required changes in one PR, cause otherwise both implementation would stay for a while in repo which could be very unclear and misleading

So here is a list of changes I've put here:

  1. Create haskell_bazel_integration_test rule for integration test
    with test scenario written in haskell and similar to go_bazel_test setup procedure
  2. Create rules_haskell_integration_test macro for integration test running
    haskell scenario with all bazel versions supported in rules_haskell
  3. Remove rules_go-based integration_test implementation
  4. Remove rules_go patching for the sake of this implementation
  5. Create IntegrationTesting library with helper functions formerly
    located in RunTests.hs
  6. Reimplement existing integration_test implementations with
    rules_haskell_integration_test

…sts:

    * create haskell_bazel_integration_test rule for integration test
      with test scenario written in haskell and similar to go_bazel_test setup procedure
    * create rules_haskell_integration_test macro for integration test running
      haskell scenario with all bazel versions supported in rules_haskell
    * remove rules_go-based integration_test implementation
    * remove rules_go patching for the sake of this implementation
    * create IntegrationTesting library with helper functions formerly
      located in RunTests.hs
    * Reimplement existing integration_test implementations with
      rules_haskell_integration_test
@googleson78
Copy link
Contributor

googleson78 commented Jun 24, 2022

Awesome!

Regarding 6., I added a couple more tests using the old framework in tests/haskell_module/repl, so you might have to modify those as well.

rules_haskell_integration_test
@googleson78
Copy link
Contributor

Thanks! Sorry for creating additional work for the migration.

@k1nkreet
Copy link
Contributor Author

Thanks! Sorry for creating additional work for the migration.

There is plenty of it still in RunTests.hs, so don't be :)

Ilya Polyakovskiy added 6 commits June 24, 2022 15:13
integration testing, put those dependencies downloading in
tests/integration_testing/dependencies.bzl
rules_bazel_integration_test, removed redundant set of TMPDIR
rules_haskell_integration_test, fix buildifier formatting
@k1nkreet
Copy link
Contributor Author

Tests on Windows are failing due to the bug in rules_bazel_integration_test. I'm going to help with debug and fixing it. In the meantime we can ignore these tests on windows until it fixed, or just wait for the fix

@k1nkreet k1nkreet requested a review from aherrmann June 28, 2022 08:08
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.

Thanks a lot for pushing this forward! This looks a lot more pleasant to use!

A couple comments/questions.

I'm going to help with debug and fixing it. In the meantime we can ignore these tests on windows until it fixed, or just wait for the fix

Thanks! Happy to temporarily skip those on Windows. You could already line up a PR to re-enable them so that it's not forgotten.

tests/integration_testing/IntegrationTesting.hs Outdated Show resolved Hide resolved
tests/integration_testing/IntegrationTesting.hs Outdated Show resolved Hide resolved
.bazelrc Show resolved Hide resolved
shell.nix Outdated Show resolved Hide resolved
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.

Thank you, that looks great!

I fixed a couple typos in the README, please take another look in case I messed something up.

@k1nkreet
Copy link
Contributor Author

k1nkreet commented Jul 1, 2022

Thank you, that looks great!

I fixed a couple typos in the README, please take another look in case I messed something up.

Thanks! Btw there is a problem with Cross ci job. It complains on "no space left on device" for some Nix operations. Do you have an idea how we could fix it?

@aherrmann
Copy link
Member

Btw there is a problem with Cross ci job. It complains on "no space left on device" for some Nix operations. Do you have an idea how we could fix it?

Hmm, this is odd. It seems to be failing when fetching haskell.nix already.

unpacking 'https://github.com/input-output-hk/hackage.nix/archive/3bce0587d9ffe56d11e83b5eeccd63e49b643bdd.tar.gz'...
tar: hackage/sloane-1.8.2-r0-26781c13cac7e1a8a70fb3928e39a4b6bac5b6ea742f83ddc174a3b915ba8207.nix: Cannot write: No space left on device

I'm not sure what's causing this. AFAIK nothing in this PR should affect that pipeline, right?

@k1nkreet
Copy link
Contributor Author

k1nkreet commented Jul 1, 2022

I'm not sure what's causing this. AFAIK nothing in this PR should affect that pipeline, right?

Yes, and it was passing before README fixes, which I hardly believe could influence this

@k1nkreet
Copy link
Contributor Author

k1nkreet commented Jul 5, 2022

I removed setting TMPDIR=/tmp from shell.nix cause it was a hack needed by previous implementation of integration testing, but it turned out that now nix-shell could not install it's dependencies sometimes because standard Nix TMPDIR has not enough space. So I returned this setting back for now

Ilya Polyakovskiy added 2 commits July 5, 2022 16:12
…newer

version where dependency on clang is removed
 * Remove clang dependency in shell.nix
its possible now in rules_bazel_integration_test
@k1nkreet
Copy link
Contributor Author

k1nkreet commented Jul 5, 2022

Since bazel-contrib/rules_bazel_integration_test#71 is merged, there is an ability to specify the env for integration test. So I've changed a way how nixpkgs indication get passed into the test from command line to environment. Among other things, It allows to wrap integration tests with hspec again as it was done in RunTests.hs and which I removed because it was impossible to use command line with it. I was going to return it back, but I'm doubting if it's actually useful in this scenario (when every test is a separate executable running probably one function). @aherrmann Do you have an opinion?

@aherrmann
Copy link
Member

@k1nkreet I'd say, what's important is that test failures produce equally clear and understandable error messages. Otherwise, as you say, if each binary represents a single test anyway, then there isn't much benefit in wrapping it in hspec.

@k1nkreet
Copy link
Contributor Author

k1nkreet commented Jul 7, 2022

@aherrmann Can we add this to the merge queue, or there is something else to fix?

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.

Looks good to merge. 🎉

@aherrmann aherrmann added the merge-queue merge on green CI label Jul 7, 2022
@mergify mergify bot merged commit 62a3583 into master Jul 7, 2022
@mergify mergify bot deleted the ip/bazel-integration-test branch July 7, 2022 15:25
@mergify mergify bot removed the merge-queue merge on green CI label Jul 7, 2022
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.

None yet

3 participants