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

add user home dir #80

Merged
merged 10 commits into from
Sep 9, 2024
Merged

add user home dir #80

merged 10 commits into from
Sep 9, 2024

Conversation

Tianhao-Gu
Copy link
Collaborator

No description provided.

Copy link

codecov bot commented Sep 6, 2024

Codecov Report

Attention: Patch coverage is 87.87879% with 4 lines in your changes missing coverage. Please review.

Project coverage is 62.36%. Comparing base (c0e6b10) to head (637480f).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
src/jupyterhub_config/custom_spawner.py 87.87% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #80      +/-   ##
==========================================
+ Coverage   57.14%   62.36%   +5.22%     
==========================================
  Files           5        5              
  Lines         154      186      +32     
==========================================
+ Hits           88      116      +28     
- Misses         66       70       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/jupyterhub_config/custom_spawner.py Show resolved Hide resolved
src/jupyterhub_config/custom_spawner.py Outdated Show resolved Hide resolved
src/jupyterhub_config/custom_spawner.py Outdated Show resolved Hide resolved
src/jupyterhub_config/custom_spawner.py Show resolved Hide resolved
src/jupyterhub_config/custom_spawner.py Show resolved Hide resolved
Comment on lines 25 to 36
global_home = Path(os.environ['JUPYTERHUB_USER_HOME'])
user_dir = global_home / username

# Ensure the system user exists
self._ensure_system_user(username, group='jupyterhub')

# Ensure the user directory exists and has correct permissions
self._ensure_user_directory(user_dir, username)

# Ensure the user's Jupiter directory exists
self._ensure_user_jupyter_directory(user_dir)

Copy link
Member

Choose a reason for hiding this comment

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

Why not move all of this into a helper method, and then you can test that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmmm I don't see any benefit for that.

Copy link
Member

Choose a reason for hiding this comment

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

You almost test the entirety of the start method, which is currently untested

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's probably fine. Unless you'd prefer making every function a public method for testing. My goal is to keep it as modular as possible, so that if we need to make changes in the future (which seems likely), it will be easier to adapt.

Copy link
Member

Choose a reason for hiding this comment

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

Unless you'd prefer making every function a public method for testing.

Nope, def not

My goal is to keep it as modular as possible, so that if we need to make changes in the future (which seems likely), it will be easier to adapt.

That's fine, but I don't see how calling _start_internal from start, having that wrap everything but stuff that touches self and testing _start_internal makes it less modular

Copy link
Member

@MrCreosote MrCreosote Sep 9, 2024

Choose a reason for hiding this comment

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

I'm fine with you not testing it for now, but I wouldn't be comfortable saying we wouldn't test it when productionizing the code, which is the message I was hearing here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 I got your point. I’m actually fine with not dedicating excessive time to unit testing at this stage or even post production. I’d prefer to focus on making progress.

Copy link
Member

Choose a reason for hiding this comment

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

I’m actually fine with not dedicating excessive time to unit testing at this stage

That's fine with me. If you write tests I review them, otherwise I don't. I think the only rule needs to be that we add test files that import new code so it gets marked in Codecov as uncovered.

or even post production

If I'm understanding what you mean here I don't think this is ok. The CDM is going to be a central, critical piece of infrastructure (unlike collections, which is off-to-the-side when it comes to KBase infrastructure) and is going to need automated testing with good coverage.

Also, to be frank I found it harder and harder to work on collections due to the lack of automated testing and possibility of regressions, which is why I'm adding more tests to the cdm task service than I did to collections

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am confused. You are okay with just an import file but also insist on putting everything into a helper function and test it? It's either no test or making it test everything?

Copy link
Member

Choose a reason for hiding this comment

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

I'm ok with just imports now, but before we go to production it needs coverage via automated tests

test/src/jupyterhub_config/custom_spawner_test.py Outdated Show resolved Hide resolved
@Tianhao-Gu Tianhao-Gu merged commit 8f84670 into main Sep 9, 2024
9 of 10 checks passed
@Tianhao-Gu Tianhao-Gu deleted the dev_jupyterhub branch September 9, 2024 21:15
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