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

Sandbox testing in CI #6

Merged
merged 21 commits into from
Sep 12, 2024
Merged

Sandbox testing in CI #6

merged 21 commits into from
Sep 12, 2024

Conversation

0mar
Copy link
Collaborator

@0mar 0mar commented Sep 9, 2024

Set up unit testing and integration testing with CI.

Backend changes

  • Changes app setup from 'on import' to 'with factory', to make testing easier

Testing setup

  • Add CI in Github Actions to install package and run unit tests
  • Add cloning and installing SMART sandbox in Github Actions
  • Add fixtures for
    • Hub service app
    • RSA key generation
    • Sandbox setup
    • Sandbox configuration
  • Add unit tests for hub service

Notes

  • I had to reverse engineer the sandbox a bit to find out how they set up their launch url.
  • I did not succeed in testing the token for code exchange, something is off with the flask test session management

@0mar 0mar requested a review from minrk September 12, 2024 06:25
from urllib import parse


@pytest.fixture(scope="function") # module?
Copy link
Member

Choose a reason for hiding this comment

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

Is it stateful? I'd probably do scope="session"

return {"SSH_KEY_PATH": str(private_key_path), "SSH_KEY_ID": "test_key"}


@pytest.fixture(scope="function")
Copy link
Member

Choose a reason for hiding this comment

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

function is the dedfault scope, you can use:

Suggested change
@pytest.fixture(scope="function")
@pytest.fixture

for most fixtures

assert response.status_code == 200
assert response.url.startswith(ext_url + smart_path)

# TODO: Should I test token existence? And how?
Copy link
Member

Choose a reason for hiding this comment

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

Testing token existence will be easier when the tokens are put somewhere.

We still need to make tokens available to notebooks, and storing them in server settings doesn't quite do that. Once we figure out how notebooks should retrieve tokens, this will be testable.

@minrk minrk merged commit bfc44a4 into main Sep 12, 2024
1 check passed
@minrk minrk deleted the sandbox-testing-in-ci branch September 12, 2024 12:21
@minrk
Copy link
Member

minrk commented Sep 12, 2024

Thanks!

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