[Asterisk-code-review] testsuite: Allow copying of arbitrary files to asterisk instances (testsuite[16])
George Joseph
asteriskteam at digium.com
Thu Sep 30 15:17:15 CDT 2021
George Joseph has uploaded a new patch set (#2). ( https://gerrit.asterisk.org/c/testsuite/+/16563 )
Change subject: testsuite: Allow copying of arbitrary files to asterisk instances
......................................................................
testsuite: Allow copying of arbitrary files to asterisk instances
If you have a key or certificate file that has to go in
/var/lib/asterisk/keys, there was no way for a test to get
that file into that directory. Various work-arounds ensued.
* Added automatic installation of files in a test's "files"
directory to its Asterisk instance's well-known directories.
To use, create directories named after entries in the
asterisk.conf "directories" category and place your files there.
It works much like the test's "configs" directory.
For example:
mytest/
configs/
ast1/
someconfig.conf
ast2/
someconfig.conf
files/
common/
astvarlibdir/
keys/
ca.crt
ast1/
astvarlibdir/
keys/
mykey1.pem
ast2/
astvarlibdir/
keys/
mykey2.pem
test-config.yaml
Since 'astvarlibdir' is usually defined in asterisk.conf as
'/var/lib/asterisk', this would copy 'ca.crt' to both Asterisk
instance's '/var/lib/asterisk/keys' directory, 'mykey1.pem' to
the first Asterisk instance's '/var/lib/asterisk/keys' directory
and 'mykey2.pem' to the second instance's '/var/lib/asterisk/keys'
directory.
Each of the instance's "someconfig.conf" could reference those
files like so:
cacert = <<astvarlibdir>>/keys/ca.crt.pem
keyfile = <<astvarlibdir>>/keys/mykeyN.pem
If you have files that can be shared among tests, you can define
'base-files-path' in each test's 'test-object-config' section which
would point to a directory structured like the 'files' directory
above.
For example
mytests/
myfiles/
common/
astvarlibdir/
keys/
ca.crt
ast1/
astvarlibdir/
keys/
mykey1.pem
ast2/
astvarlibdir/
keys/
mykey2.pem
mytest1/
...
mytest2/
...
Then in both test's test-config.yaml...
test-object-config:
base-files-path: 'tests/mytests/myfiles'
base-files-path is processed before the automatic files
processing of each test so individual tests can add its own files
or even override a common file if it chooses.
ASTERISK-29675
Change-Id: I69bb54fea459e83f65a474d3b74c40b28fe01b4c
---
M README.txt
M lib/python/asterisk/asterisk.py
M lib/python/asterisk/test_case.py
A lib/python/polyfill.py
M sample-yaml/test-config.yaml.sample
5 files changed, 218 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/63/16563/2
--
To view, visit https://gerrit.asterisk.org/c/testsuite/+/16563
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: I69bb54fea459e83f65a474d3b74c40b28fe01b4c
Gerrit-Change-Number: 16563
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-CC: Friendly Automation
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210930/4713b78f/attachment.html>
More information about the asterisk-code-review
mailing list