Skip to content

Replaced python container launcher with GHA service #85

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

Closed
wants to merge 2 commits into from

Conversation

joshthoward
Copy link
Member

Was able to remove a couple hundred lines of integration_tests/conftest.py by making use of GitHub Actions Service feature. I think it's cleaner with the change.

@cla-bot cla-bot bot added the cla-signed label Apr 20, 2021
Copy link
Member

@hashhar hashhar 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 % extract trino version to a constant somewhere so that it's easier to know where to change it when running tests against a different version.

@joshthoward
Copy link
Member Author

@hashhar just pushed it as a global variable in integration_tests/test_dbapi.py. LMK if you think that I should instead pass it in as an environment variable... I am on the fence.

@hashhar
Copy link
Member

hashhar commented Apr 20, 2021

The global var looks good to me, I don't think we need an ENV var yet. The only reason to change the version could be to reproduce a bug with an older version or to test with a newer version.

@findepi
Copy link
Member

findepi commented Apr 20, 2021

Does it affect running tests from an IDE like PyCharm? How?

@joshthoward
Copy link
Member Author

IDK how this would affect an IDE. The same tests are ran, but they assume that you start up a Trino container before running. So you might have an extra step, but integration test runs are way faster given that they don't have to pull down and run a container each time.

Timing it locally, I got roughly a 5x improvement.

# jh/test-refactor
pytest integration_tests  1.12s user 0.15s system 25% cpu 5.003 total
# master
pytest integration_tests  1.36s user 0.27s system 6% cpu 26.703 total

@findepi
Copy link
Member

findepi commented Apr 20, 2021

In Trino we have two kinds of integrations tests

  • product tests, where we have separate environment setup and test execution. You can some of these test from IDE provided you start environment manually.
  • "unit tests", where the test is responsible for provisioning all the necessary resources. These tests can be run from IDE with a click.

The second type of the tests is usually regarded as simple and easy to use, while the first one is regarded as hard to use and work with.

Are we basically converting "unit tests" into "product tests" here?

@joshthoward
Copy link
Member Author

I see where you are going, but it's not a fair comparison. The tradeoffs are below.

Pros:

  • 5x faster per run
  • Less code
  • Declarative API for integration test requirements

Cons:

  • Must run Trino outside of IDE before running integration tests through IDE

@dungdm93
Copy link
Member

Hi @joshthoward, is there any way to mount trino configs (e.g catalog files) to that service?

@joshthoward
Copy link
Member Author

You can add volume mounts, but I would probably build a separate container for testing if needed. Tests should rely on TPC-H tiny if possible.

Copy link
Member

@ebyhr ebyhr left a comment

Choose a reason for hiding this comment

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

test_eager_loading_cursor_description will fail after rebase on upstream. Version up (351 → 355) looks unrelated for the failure, but I didn't investigate the detail.

Copy link
Member

@hashhar hashhar 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 % unresolved comments.

However I do think we'll end up back at code-defined environments once we start adding integration tests for things like auth mechanisms etc. We'll think about it when we get there.

@joshthoward joshthoward force-pushed the jh/test-refactor branch 3 times, most recently from 4555b15 to ff7aa8c Compare August 12, 2021 16:50
@joshthoward
Copy link
Member Author

GH is deciding not to accept the second half of this commit... SMH

% git diff 9ae518f688112f644bdab40a13896fb47bf581fe
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4349464..db971a5 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,7 +7,7 @@ jobs:
     runs-on: ubuntu-latest
     services:
       trino:
-        image: trinodb/trino:355
+        image: trinodb/trino:360
         ports:
           - 8080:8080
     strategy:
diff --git a/integration_tests/test_dbapi.py b/integration_tests/test_dbapi.py
index 8ba840c..474b581 100644
--- a/integration_tests/test_dbapi.py
+++ b/integration_tests/test_dbapi.py
@@ -24,7 +24,7 @@ from trino.transaction import IsolationLevel

 HOST = 'localhost'
 PORT = 8080
-TRINO_VERSION = '355'  # The Trino server version used for integration tests
+TRINO_VERSION = '360'  # The Trino server version used for integration tests

@joshthoward joshthoward reopened this Aug 12, 2021
@joshthoward
Copy link
Member Author

@ebyhr, @hashhar should be good to go. LMK if you have any further comments.

@hashhar
Copy link
Member

hashhar commented Dec 10, 2021

Turns out we'll need the ability to have programmatic integration test environments since we want to test a matrix of versions now to make sure newer clients are compatible with older ones (and different server versions).

@joshthoward I'm closing this accordingly.

@hashhar hashhar closed this Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants