-
Notifications
You must be signed in to change notification settings - Fork 47
[IO-1556] Create and push E2E test #661
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
Conversation
| f._error("Darwin seems unreachable, please try again in a minute or contact support.") | ||
| except GracefulExit as e: | ||
| f.error(e.message) | ||
| f._error(e.message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this made it in but may as well stay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is a bit weird, but nvm as you say.
owencjones
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff man, sorry I wasn't about to help out more tail end of the week.
.github/workflows/tests.yml
Outdated
| pip install pytest pytest-describe | ||
| - name: Run Tests | ||
| run: python -m pytest -W ignore::DeprecationWarning | ||
| e2e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll need to transplant these in the new refactor of the GHAs, but that's my problem for not getting them in first.
.github/workflows/tests.yml
Outdated
| pip install --upgrade setuptools | ||
| pip install --editable ".[test,ml,medical,dev]" | ||
| pip install pytest pytest-describe | ||
| - name: Run Tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be added as a step under the existing installs from the tests job, but I'd say in this instance, I've got a load of pending changes to this area, including this, so I can incorporate it.
e2e_tests/conftest.py
Outdated
| # pytest.datasets = datasets | ||
| setattr(pytest, "datasets", datasets) | ||
| # Set the environment variables for running CLI arguments | ||
| os.environ["DARWIN_BASE_URL"] = server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
| ) | ||
|
|
||
| return result.returncode, result.stdout.decode("utf-8"), result.stderr.decode("utf-8") | ||
| try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work around, but I really hate this for the stdlib inconsistencies!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it makes sense given it's just a byte string, but still
| @@ -0,0 +1,68 @@ | |||
| import re | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice first test. Good to see it starting to come together.
.github/workflows/tests.yml
Outdated
| E2E_ENVIRONMENT: ${{ secrets.E2E_ENVIRONMENT }} | ||
| E2E_TEAM: ${{ secrets.E2E_TEAM }} | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too much newlines
.github/workflows/tests.yml
Outdated
| pip install pytest pytest-describe | ||
| - name: Run Tests | ||
| run: python -m pytest -W ignore::DeprecationWarning | ||
| e2e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about moving this to separate file?
| setattr(pytest, "datasets", datasets) | ||
| # Set the environment variables for running CLI arguments | ||
| environ["DARWIN_BASE_URL"] = server | ||
| environ["DARWIN_TEAM"] = team_slug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, after setting ENV's you want to revert them, as this is change to global state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's slightly misleading - it looks like a change to global state, but posix env vars, which these will be in most cases, are in one of two scopes, global or local - os.environ is changing the local (process) scope, at least in a posix-like system.
In windows, it might set it globally.
Obv, unsetting these wouldn't hurt, just adding context.
e2e_tests/helpers.py
Outdated
| try: | ||
| return result.returncode, result.stdout.decode("utf-8"), result.stderr.decode("utf-8") | ||
| except: | ||
| return result.returncode, result.stdout.decode("cp437"), result.stderr.decode("cp437") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no newline
e2e_tests/test_darwin.py
Outdated
| if __name__ == "__main__": | ||
| pytest.main(["-vv", "-s", __file__]) | ||
|
|
||
|
No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no newline
e2e_tests/test_darwin.py
Outdated
| assert local_dataset.name is not None | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this different amount of lines between tests intended?
e2e_tests/conftest.py
Outdated
| api_key = environ.get("E2E_API_KEY") | ||
| team_slug = environ.get("E2E_TEAM") | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
owencjones
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, like it, all looks good, and the slack integ is good blueprint for the incoming one from my branch
| { | ||
| "channel": "#${{ vars.SLACK_CHANNEL }}", | ||
| "username": "${{ vars.SLACK_USERNAME }}", | ||
| "text": "Nightly E2E run failed <!subteam^S04T5MWDHJ6>: https://github.com/v7labs/darwin-py/actions/runs/${{ github.run_id }}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun fact: you can also email this id and send a message.
| f._error("Darwin seems unreachable, please try again in a minute or contact support.") | ||
| except GracefulExit as e: | ||
| f.error(e.message) | ||
| f._error(e.message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is a bit weird, but nvm as you say.
| setattr(pytest, "datasets", datasets) | ||
| # Set the environment variables for running CLI arguments | ||
| environ["DARWIN_BASE_URL"] = server | ||
| environ["DARWIN_TEAM"] = team_slug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's slightly misleading - it looks like a change to global state, but posix env vars, which these will be in most cases, are in one of two scopes, global or local - os.environ is changing the local (process) scope, at least in a posix-like system.
In windows, it might set it globally.
Obv, unsetting these wouldn't hurt, just adding context.
| del environ["DARWIN_BASE_URL"] | ||
| del environ["DARWIN_TEAM"] | ||
| del environ["DARWIN_API_KEY"] | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, @brain-geek turns out it doesn't matter anymore anyway!
Problem
No E2E tests for darwin cli exists
Solution
Add in E2E tests and fixes to get tests running
Changelog
Testing added for create and basic push tests via cli