-
Notifications
You must be signed in to change notification settings - Fork 1
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
Automatically run services in loops #18
base: daniel-starter
Are you sure you want to change the base?
Conversation
initialize the test repo: In [1]: from test_looper.utils.services import init_test_repo
In [2]: init_test_repo()
Initialized empty Git repository in /tmp/0a198894-4a25-4dcf-8d2d-eecea58308a1/_template_repo/.git/
[main (root-commit) 95cee6f] initial commit
3 files changed, 11 insertions(+)
create mode 100644 test_looper.json
create mode 100644 tests/__pycache__/test_cases.cpython-38-pytest-7.1.2.pyc
create mode 100644 tests/test_cases.py
Out[2]: '/tmp/0a198894-4a25-4dcf-8d2d-eecea58308a1/_template_repo' nothing should happen yet because this is just the "remote" and TestLooper doesn't know this repo yet. |
connect to odb and test_looper_schema: from test_looper import test_looper_schema
from object_database import connect
odb = connect('localhost', 8080, 'TOKEN')
odb.subscribeToSchema(test_looper_schema) registry the repository with test looper: from test_looper.service import LooperService
looper = LooperService(odb, repo_url='/tmp/test_looper/repos')
looper.add_repo("template_repo", "/tmp/0a198894-4a25-4dcf-8d2d-eecea58308a1/_template_repo") Now in the terminal that you ran ./start_services.py, you should see: |
In a terminal, go to the "remote" repo and add a commit: echo "foo" > new_commit.txt
git add .
git commit -m "new commit" In the services window, you should see the tests running again:
|
Now let's verify ODB state: We should have 1 repo with 2 commits which means 2 TestNodes and 2 TestResults: In [6]: with odb.view():
...: for repo in Repository.lookupAll():
...: print(repo)
...:
test_looper.Repository(id=700000000)
In [7]: with odb.view():
...: for c in Commit.lookupAll():
...: print(c)
...:
test_looper.Commit(id=1200000002)
test_looper.Commit(id=2000000002)
In [8]: with odb.view():
...: for t in TestNode.lookupAll():
...: print(t)
...:
test_looper.TestNode(id=1200000005)
test_looper.TestNode(id=2000000005)
In [9]: with odb.view():
...: for rs in TestResults.lookupAll():
...: print(rs)
...:
test_looper.TestResults(id=1300000003)
test_looper.TestResults(id=2100000003) |
Previously you had to manually execute all of the services to "step" through each iteration of scanning, parsing, testing.
This PR converts the test looper services into ODB ServiceBase's with Reactors.
Parser service
Runner service
For local convenience, added
test.sh
in the repo root so you don't need to explicitly pass in the markers to skip etc.