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 Supplementary group tests #63

Closed
wants to merge 5 commits into from

Conversation

spuiuk
Copy link
Collaborator

@spuiuk spuiuk commented Jan 31, 2024

*** EDIT - Step 1 is now handled in PR #73. Please use this PR only for the supplementary group tests ***
Step 1:
Change the way we describe exports in the test-info.yml file.

  1. Introduce exported_shares option.
exported_shares:
  - {"name": "export2"}
  - {"name": "export3", "mntdir": "/mnt-cephfs", "fs": "cephfs"}

This allows us to describe both plain exportes smbshares plus premounted shares and the backing filesystem.

  1. remove section premounted_shares.
    These aren't used in the automated testing yet and can be described through exported_shares section.

Step 2:
Add supplementary group test.

The motivation for making this changes is to cater to a new type of tests which require access to the underlying filesystem outside of SMB/samba. Changes to test-info.yml allow an easy way to describe an exported share where I also give the location of the direct mount so that we can perform these filesystem operations.

The new test added is a Supplementary group test where the following requirements are needed.

  1. user defined in test-info.yml should be part of the sg supplementary group.
  2. Access to the backend fs outside of SMB is needed - We need to setup a directory to which the supplementary group has write access. We test if the user who is part of the supplementary group has write access.
    In this case, we cannot write to the backend using vfs_cephfs module but the write on a filesystem mounted using the ceph-fuse module works fine.

Depends on #73

@spuiuk spuiuk marked this pull request as draft January 31, 2024 19:47
@spuiuk spuiuk force-pushed the exports_fix branch 2 times, most recently from 29a4f47 to 4a4789c Compare February 1, 2024 15:19
@spuiuk spuiuk changed the title Exports fix Add Supplementary group tests Feb 1, 2024
@spuiuk spuiuk force-pushed the exports_fix branch 2 times, most recently from 8f845a8 to 37c6e1a Compare February 7, 2024 17:33
@spuiuk spuiuk marked this pull request as ready for review February 7, 2024 17:33
@spuiuk spuiuk force-pushed the exports_fix branch 2 times, most recently from 76d7f7d to 08863bc Compare February 7, 2024 17:38
@@ -9,12 +9,16 @@ public_interfaces:
exported_sharenames:
- "gluster-vol"

# List of dict of exported shares
# name: share_name
# mntdir: If this is a premounted share, the mount directory
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can rephrase it as mount directory in case of a premounted share

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

if "shares" in test_info:
return test_info["shares"]

default_fs = test_info.get("test_backend", None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it necessary to use None here as default value when a key is not present in dict is already None

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@@ -9,12 +9,16 @@ public_interfaces:
exported_sharenames:
- "gluster-vol"

# List of dict of exported shares
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be exported_shares: list of dict of exported shares

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@@ -9,12 +9,16 @@ public_interfaces:
exported_sharenames:
- "gluster-vol"

# List of dict of exported shares
# name: share_name
# mntdir: If this is a premounted share, the mount directory
Copy link
Collaborator

Choose a reason for hiding this comment

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

mntdir: mount directory in a premounted share would sound better

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

"""
Is the share dict a premounted share

Paramters:
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo: parameters

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed


def is_premounted_share(share: dict) -> bool:
"""
Is the share dict a premounted share
Copy link
Collaborator

Choose a reason for hiding this comment

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

check if the share is premounted would sound better

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Copy link
Collaborator

@Shwetha-Acharya Shwetha-Acharya left a comment

Choose a reason for hiding this comment

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

May be you can describe this change in more detail in the commit message (misc: Add test for supplementary groups for some of us to know better about the need of test for supplementary groups

@spuiuk spuiuk force-pushed the exports_fix branch 2 times, most recently from 9aa05e0 to 8026a1d Compare February 22, 2024 16:05
@spuiuk
Copy link
Collaborator Author

spuiuk commented Feb 22, 2024

May be you can describe this change in more detail in the commit message (misc: Add test for supplementary groups for some of us to know better about the need of test for supplementary groups

Instead of the commit message, I've added it to the python file directly. This allows users to get the information directly from the test files.

Copy link
Collaborator

@Shwetha-Acharya Shwetha-Acharya left a comment

Choose a reason for hiding this comment

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

Added few comments.
Rest of the implementation looks good to me.

@@ -9,12 +9,16 @@ public_interfaces:
exported_sharenames:
- "gluster-vol"

# exported_shares: List of dict of exported shares
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using multi line comment here similar to testheper.py would be better as it would appear more readable

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is an example file for yaml content. Yaml doesn't allow multi line comments like in Python.

@@ -9,12 +9,16 @@ public_interfaces:
exported_sharenames:
- "gluster-vol"

# exported_shares: List of dict of exported shares
# name: share_name
Copy link
Collaborator

Choose a reason for hiding this comment

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

just curious why we would need a separate exported_sharenames and again a name exported_shares.

Let me know if they are any different or there is any special use case? If not could we just use share name from exported_shares?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They have 2 different formats in the way they are expressed in the yaml. exported_sharenames is how it is currently reported but it only lists the shares exported from that sharename which is inadequate for a complex test. This is currently used by sit-environment to report the shares but in the future we want to move to providing additional information in exported_shares which the current exported_sharename field doesn't provide.

Since we have multiple projects, we have a chicken and egg problem. We can't make changes to one which will break the testing on the other. So for now, the changes ensure that both exported_sharenames and exported_shares are supported. Once these changes go in, I will put in a PR to move sit-environment to use exported_shares instead of exported_sharenames. Once changes go into both, we can consider removing support for exported_sharenames.

Copy link

@xhernandez xhernandez left a comment

Choose a reason for hiding this comment

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

Since SIT environment is becoming more configurable now, and it could provide more complex configurations in the near future, I think we should also make the test-info.yml configuration more flexible.

I would nest all configuration below each share, so that different share can have different configurations.

For example:

shares:
  share-cephfs-vfs:
    # If present, it means share is pre-mounted
    path: /mnt/share/share-cephfs-vfs
    backend:
      name: cephfs
      variant: vfs
      # If present, this provides direct access to the backend, bypassing Samba
      path: /mnt/backend/share
    users:
      test1: x
      test2: x
    addresses:
      - 192.168.123.10
      - 192.168.123.11

@spuiuk
Copy link
Collaborator Author

spuiuk commented Feb 28, 2024

Thanks, As discussed on chat, we will also add options to add default options which will make it easier to write the test-info.yml files manually.

@spuiuk spuiuk force-pushed the exports_fix branch 3 times, most recently from deb1772 to bbc0173 Compare March 5, 2024 22:40
@spuiuk
Copy link
Collaborator Author

spuiuk commented Mar 7, 2024

I have uploaded the latest changes. The supplementary tests will not be automatically run in the sit-environment since we have not setup backend filesystems and the sit-environment will have to be modified to use the new format for test-info.yml before we can run the supplementary tests.

However the changes introduced here changes the way we layout the environment in test-info.yml.

We do not use this section in any of our current tests and I don't
forsee the need for this in the near future.

Signed-off-by: Sachin Prabhu <[email protected]>
Avoid directly accessing the test_info dict and use helper function
instead. This will allow us to modify the test_info.yml with minimal
disruption.

Signed-off-by: Sachin Prabhu <[email protected]>
Change the way we list shares in test-info.yml
This will be used to add additional functionality to tests.

eg:
shares:
  # share name export1
  export1:
    # If present, it means the share is pre-mounted
    path: /mnt/share/export1-cephfs-vfs
    backend:
      # If present backend filesystem
      name: cephfs.vfs
    # If present, username to perform the tests with on this share
    users:
      test2: x
    # If present, the hostname to use to connect to the test server
    server: hostname1
  export2:

This commit still supports the old format of test-info.yml. The new
changes deprecates the old test-info.yml format which can be removed
once the sit-environment has been updated.

Signed-off-by: Sachin Prabhu <[email protected]>
@spuiuk spuiuk mentioned this pull request Mar 23, 2024
Add  share["backend"]["path"] to indicate where direct access to the
share is available.

Add helper function get_shares_with_directmnt() to locate shares with
direct access to the exported path available

Signed-off-by: Sachin Prabhu <[email protected]>
@spuiuk
Copy link
Collaborator Author

spuiuk commented Mar 23, 2024

Depends on #73

@spuiuk
Copy link
Collaborator Author

spuiuk commented Mar 23, 2024

Split this PR with the changes to test-info.yml now handled in #73. Please use this PR to comment on supplementary tests.

Copy link

dpulls bot commented Mar 26, 2024

🎉 All dependencies have been resolved !

@anoopcs9 anoopcs9 mentioned this pull request May 2, 2024
@spuiuk
Copy link
Collaborator Author

spuiuk commented May 2, 2024

Closing this issue in favour of PR #79.

There are several changes made to the underlying code which necessitates re-writing a large part of the testing infrastructure. This includes the changes to the way test-info.yaml is specified as well as using the pysmb module to connect to the remote smb server.

@spuiuk spuiuk closed this May 2, 2024
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.

3 participants