[Asterisk-code-review] python libs: Add capability to set file permissions on a tests files (testsuite[16])

George Joseph asteriskteam at digium.com
Fri Oct 14 06:10:40 CDT 2022


Attention is currently required from: George Joseph.

Hello Michael Bradeen, Friendly Automation, 

I'd like you to reexamine a change. Please visit

    https://gerrit.asterisk.org/c/testsuite/+/19414

to look at the new patch set (#2).

Change subject: python libs: Add capability to set file permissions on a tests files
......................................................................

python libs: Add capability to set file permissions on a tests files

When testing encryption related scenarios, key files may need to
have specific permissions set in order for them to be used. See
https://issues.asterisk.org/jira/browse/ASTERISK-30213 for more
context.  Since git doesn't natively support saving file
permissions other than the executable bit, we needed a way to set
them ourselves.

* The asterisk instance setup functions have been updated to
  look for a file named ".permissions" in a test's config and
  files directories which contains a list of files and octal
  permissions to set before running the test.

  For files in the config directory that are copied to
  /etc/asterisk, the .permissions file must be in the
  testdir/configs/astX directory.

  Example:
  testdir/
    test_config.yaml
    configs/
      ast1/
        .permissions
        mykey.pem

  The .permissions file would have the following:
  # Permissions file for private key
  mykey.pem:0600

  For files copied to other places, the .permissions file
  must be under the last symbolic part of the path.
  Example:

  testdir/
    test_config.yaml
    files/
      ast1/
        astvarlibdir/
          .permissions
          keys/
            test.key

  The .permissions file would have the following:
  # Permissions file for private key
  keys/test.key:0600

  When this particular test runs, the .permissions file
  will be processed and permissions set before the test
  actually executes.

* .permissions files  have been created for the two immediate tests
  with issues:
  tests/channels/iax2/encrypted-calls/rsa
  tests/channels/iax2/encrypted-calls/rsa-dynamic

Change-Id: I4169b64c4e61b5856468a048c9fa138d81209831
---
M lib/python/asterisk/asterisk.py
M lib/python/asterisk/test_suite_utils.py
A tests/channels/iax2/encrypted-calls/rsa-dynamic/files/ast1/astvarlibdir/.permissions
A tests/channels/iax2/encrypted-calls/rsa/files/ast1/astvarlibdir/.permissions
4 files changed, 121 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/14/19414/2
-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/19414
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: I4169b64c4e61b5856468a048c9fa138d81209831
Gerrit-Change-Number: 19414
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-CC: Philip Prindeville <philipp at redfish-solutions.com>
Gerrit-Attention: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221014/8b6cff2d/attachment.html>


More information about the asterisk-code-review mailing list