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

show a short list of mount infos: files_external:list --short #32178

Merged
merged 2 commits into from
Nov 28, 2018

Conversation

mmattel
Copy link
Contributor

@mmattel mmattel commented Jul 27, 2018

This is a new PR for #32098 because of a push problem killing the commit.

Description

This PR adds an option -s --short to sudo -uwww-data ./occ files_external:list user_id

Related Issue

Motivation and Context

The current output of ./occ files_external:list user_id is quite big and for some purposes hard to read. This short view helps when using in conjunction of files:scan with option --path= to identify easily the scannable paths for a user.

How Has This Been Tested?

sudo -uwww-data ./occ files_external:list user_1 --short
+----------+------------------+----------+
| Mount ID | Mount Point      | Type     |
+----------+------------------+----------+
| 1        | /mount_1         | Personal |
| 2        | /mount_2         | Personal |
+----------+------------------+----------+

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • Backport (if applicable set "backport-request" label and remove when the backport was done)

@PVince81 I added the changes requested from the original PR

@codecov
Copy link

codecov bot commented Jul 27, 2018

Codecov Report

Merging #32178 into master will increase coverage by 0.01%.
The diff coverage is 85.07%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #32178      +/-   ##
============================================
+ Coverage     64.33%   64.34%   +0.01%     
  Complexity    18305    18305              
============================================
  Files          1195     1195              
  Lines         69193    69228      +35     
  Branches       1276     1276              
============================================
+ Hits          44517    44548      +31     
- Misses        24304    24308       +4     
  Partials        372      372
Flag Coverage Δ Complexity Δ
#javascript 52.96% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 65.66% <85.07%> (+0.01%) 18305 <0> (ø) ⬇️
Impacted Files Coverage Δ Complexity Δ
apps/files_external/lib/Command/ListCommand.php 71.5% <85.07%> (+3.78%) 0 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a8fa83a...3d7f0b1. Read the comment docs.

@PVince81
Copy link
Contributor

I checked the tests in apps/files_external/tests/Command/ListCommandTest.php
but the do not take care on any existing options anyways.
There is only a check if a json output matches the requirements.
Therefore I skipped tests in the new PR.

Maybe it's a good opportunity to add the missing tests.
My worry is that you added complex-looking logic so it would be good to get it covered somehow, either my calling the private method directly (with self::invokePrivate from the test case class), or by checking for specific output either with assertContains or checking for the full table like it was done in https://github.com/owncloud/core/blob/master/tests/Core/Command/Background/Queue/StatusTest.php#L62

In general we only skip adding tests when dealing with legacy code that would require heavy refactoring to make it testable.

@mmattel
Copy link
Contributor Author

mmattel commented Jul 31, 2018

I understand your point, but do you want to address all the combinations?
And what about all the other files_external commands, there are in total 10 commands...

files_external:list

Arguments:
  user_id                user id to list the personal mounts for, 
                         if no user is provided admin mounts will be listed

Options:
      --show-password    show passwords and secrets
      --full             don't truncate long values in table output
  -a, --all              show both system wide mounts and all personal mounts
  -s, --short            show only a reduced mount info
      --output[=OUTPUT]  The output format to use (plain, json or json_pretty, default is plain).

Second, you hit my weak point: tests (😓) I am very bad in that and have honestly more or less no clue...

@mmattel
Copy link
Contributor Author

mmattel commented Aug 2, 2018

@phil-davis may I ask you for support creating tests?

@phil-davis phil-davis self-assigned this Aug 6, 2018
@phil-davis
Copy link
Contributor

Assigned myself to help with making tests.

@phil-davis
Copy link
Contributor

@mmattel I rebased this just now, to make sure the PR is up-to-date with everything in master. So if you need to touch anything, then make sure to pull down the branch from GitHub first.

@mmattel
Copy link
Contributor Author

mmattel commented Aug 26, 2018

@phil-davis any news on your support offer regarding tests ?
would like to get that merged...

@PVince81
Copy link
Contributor

@sharidas can you help with the unit tests part ?

@PVince81 PVince81 added this to the backlog milestone Oct 20, 2018
@phil-davis phil-davis removed their assignment Oct 24, 2018
@phil-davis
Copy link
Contributor

I unassigned myself - I am really not a unit test guy, and have lots of other stuff to do. I should not have offered in the first place, unit tests are more a dev team thing - sorry.

@sharidas
Copy link
Contributor

sharidas commented Nov 28, 2018

Unit test status

@PVince81 I have updated the unit tests. CI looks promising. I would like to have a review for the unit tests added.

PS: The testing is done with 2 mount points.

Update unit test for short list of mount infos feature.

Signed-off-by: Sujith H <sharidasan@owncloud.com>
Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍

@PVince81 PVince81 merged commit 6d024b8 into master Nov 28, 2018
@PVince81 PVince81 deleted the user_list_short_output branch November 28, 2018 17:15
@PVince81
Copy link
Contributor

@mmattel please backport

mmattel pushed a commit that referenced this pull request Nov 28, 2018
…tput

show a short list of mount infos: files_external:list --short
@mmattel mmattel mentioned this pull request Jan 3, 2019
39 tasks
@davitol
Copy link
Contributor

davitol commented Jan 4, 2019

The example in the OP says:

How Has This Been Tested?

sudo -uwww-data ./occ files_external:list user_1 --short
+----------+------------------+----------+
| Mount ID | Mount Point | Type |
+----------+------------------+----------+
| 1 | /mount_1 | Personal |
| 2 | /mount_2 | Personal |
+----------+------------------+----------+

Testing in my own server:

screen shot 2019-01-04 at 09 37 07

screen shot 2019-01-04 at 09 37 11

Should we show the mounts with "available for" the user? If not, Is there any other value available for Type Column apart from Personal?

(cc @mmattel)

@mmattel
Copy link
Contributor Author

mmattel commented Jan 4, 2019

Should we show the mounts with "available for" the user?

I already thought about that one...

If not, Is there any other value available for Type Column apart from Personal?

admin

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Improve files_external:list to show a short list of mounts for a given user
5 participants