1
0
mirror of https://github.com/ansible/mazer.git synced 2026-02-05 12:45:17 +01:00

update tests/use-cases.sh to use --namespace

and update the asserts to follow the namespace
This commit is contained in:
Adrian Likins
2018-06-20 10:25:58 -04:00
parent 5a5dfb5636
commit 992b6196f2

View File

@@ -41,7 +41,7 @@ tree ~/.ansible/content
rm -rf ~/.ansible/content
mazer install alikins.role-awx
tree ~/.ansible/content
# [ -d ~/.ansible/content/roles ]
# [ -d ~/.ansible/content/${NAMESPACE}/roles ]
[ -d ~/.ansible/content/alikins.role-awx/roles/role-awx ]
[ -d ~/.ansible/content/alikins.role-awx/roles/role-awx/meta ]
[ -f ~/.ansible/content/alikins.role-awx/roles/role-awx/meta/main.yml ]
@@ -49,53 +49,55 @@ tree ~/.ansible/content
# install all from a scm url
rm -rf ~/.ansible/content
mazer install git+https://github.com/atestuseraccount/ansible-testing-content.git
mazer install --namespace testing git+https://github.com/atestuseraccount/ansible-testing-content.git
tree ~/.ansible/content
# install from a scm url again without cleaning up (should fail)
mazer install git+https://github.com/atestuseraccount/ansible-testing-content.git && :
mazer install --namespace testing git+https://github.com/atestuseraccount/ansible-testing-content.git && :
RC=$?
echo "rc was $RC (70 is expected)"
[ $RC -eq 70 ]
# install from a scm url again but with --force without cleaning up (should work)
mazer install --force git+https://github.com/atestuseraccount/ansible-testing-content.git
mazer install --namespace testing --force git+https://github.com/atestuseraccount/ansible-testing-content.git
tree ~/.ansible/content
# install all with a version from scm
rm -rf ~/.ansible/content
mazer install git+https://github.com/atestuseraccount/ansible-testing-content.git,0.0.1
mazer install --namespace testing git+https://github.com/atestuseraccount/ansible-testing-content.git,0.0.1
tree ~/.ansible/content
# install all with a version from scm
rm -rf ~/.ansible/content
mazer install -t module git+https://github.com/atestuseraccount/ansible-testing-content.git,0.0.1
tree ~/.ansible/content
# install roles from a multi content archive from a scm url
rm -rf ~/.ansible/content
mazer install -t role git+https://github.com/atestuseraccount/ansible-testing-content.git
NAMESPACE='testing'
NAME='ansible-testing-content'
PACKAGE="${NAMESPACE}.${NAME}"
mazer install --namespace testing -t role git+https://github.com/atestuseraccount/ansible-testing-content.git
tree ~/.ansible/content
[ -d ~/.ansible/content/roles ]
[ -d "${HOME}/.ansible/content/roles/test-role-b" ]
[ -d "${HOME}/.ansible/content/roles/test-role-b/meta" ]
[ -f "${HOME}/.ansible/content/roles/test-role-b/meta/main.yml" ]
[ -d "${HOME}/.ansible/content/roles/test-role-b/vars" ]
[ -f "${HOME}/.ansible/content/roles/test-role-b/vars/main.yml" ]
[ ! -d "${HOME}/.ansible/content/roles/alikins.testing-content" ]
[ -d "${HOME}/.ansible/content/${PACKAGE}/roles" ]
[ -d "${HOME}/.ansible/content/${PACKAGE}/roles/test-role-b" ]
[ -d "${HOME}/.ansible/content/${PACKAGE}/roles/test-role-b/meta" ]
[ -f "${HOME}/.ansible/content/${PACKAGE}/roles/test-role-b/meta/main.yml" ]
[ -d "${HOME}/.ansible/content/${PACKAGE}/roles/test-role-b/vars" ]
[ -f "${HOME}/.ansible/content/${PACKAGE}/roles/test-role-b/vars/main.yml" ]
[ ! -d "${HOME}/.ansible/content/${PACKAGE}/roles/alikins.testing-content" ]
# install roles from a multi-content archive from galaxy
rm -rf ~/.ansible/content
mazer install -t role testing.ansible-testing-content
tree ~/.ansible/content
[ -d ~/.ansible/content/roles ]
[ -d "${HOME}/.ansible/content/roles/test-role-b" ]
[ -d "${HOME}/.ansible/content/roles/test-role-b/meta" ]
[ -f "${HOME}/.ansible/content/roles/test-role-b/meta/main.yml" ]
[ -d "${HOME}/.ansible/content/roles/test-role-b/vars" ]
[ -f "${HOME}/.ansible/content/roles/test-role-b/vars/main.yml" ]
[ ! -d "${HOME}/.ansible/content/roles/alikins.testing-content" ]
NAMESPACE='testing'
NAME='ansible-testing-content'
PACKAGE="${NAMESPACE}.${NAME}"
[ -d ~/.ansible/content/${PACKAGE}/roles ]
[ -d "${HOME}/.ansible/content/${PACKAGE}/roles/test-role-b" ]
[ -d "${HOME}/.ansible/content/${PACKAGE}/roles/test-role-b/meta" ]
[ -f "${HOME}/.ansible/content/${PACKAGE}/roles/test-role-b/meta/main.yml" ]
[ -d "${HOME}/.ansible/content/${PACKAGE}/roles/test-role-b/vars" ]
[ -f "${HOME}/.ansible/content/${PACKAGE}/roles/test-role-b/vars/main.yml" ]
[ ! -d "${HOME}/.ansible/content/${PACKAGE}/roles/alikins.testing-content" ]
# install 'all' from a repo with plugins and modules but not roles or meta repo
@@ -104,33 +106,39 @@ mazer install alikins.ansible-content-no-meta
tree ~/.ansible/content
# install modules from a multi-content repo
rm -rf ~/.ansible/content
mazer install -t module alikins.ansible-testing-content
tree ~/.ansible/content
[ -d ~/.ansible/content/library ]
# rm -rf ~/.ansible/content
# mazer install -t module alikins.ansible-testing-content
# tree ~/.ansible/content
# NAMESPACE='alikins'
# NAME='ansible-testing-content'
# PACKAGE="${NAMESPACE}.${NAME}"
# [ -d ~/.ansible/content/${PACKAGE}/library ]
# not all the modules, but at least more than one
for module_file in elasticsearch_plugin.py kibana_plugin.py redis.py ;
do
echo
# [ -f "${HOME}/.ansible/content/library/${module_file}" ]
done
# for module_file in elasticsearch_plugin.py kibana_plugin.py redis.py ;
# do
# echo
# [ -f "${HOME}/.ansible/content/${PACKAGE}/library/${module_file}" ]
# done
# install strategy plugins from a multi-content repo
rm -rf ~/.ansible/content
mazer install -t strategy_plugin alikins.ansible-testing-content
tree ~/.ansible/content
[ -d ~/.ansible/content/strategy_plugins ]
for strat_file in debug.py free.py linear.py ;
do
[ -f "${HOME}/.ansible/content/strategy_plugins/${strat_file}" ]
done
# rm -rf ~/.ansible/content
# mazer install -t strategy_plugin alikins.ansible-testing-content
# tree ~/.ansible/content
# NAMESPACE='alikins'
# NAME='ansible-testing-content'
# PACKAGE="${NAMESPACE}.${NAME}"
# [ -d ~/.ansible/content/${PACKAGE}/strategy_plugins ]
#for strat_file in debug.py free.py linear.py ;
#do
# [ -f "${HOME}/.ansible/content/${PACKAGE}/strategy_plugins/${strat_file}" ]
#done
# FIXME
# [ ! -e ~/.ansible/content/library/kibana_plugin.py ]
# [ ! -e ~/.ansible/content/${PACKAGE}/library/kibana_plugin.py ]
@@ -140,33 +148,39 @@ done
# install a signle module
# mazer install -t module atestuseraccount.testing-content.elasticsearch_plugin.py
# tree ~/.ansible/content
# [ -d ~/.ansible/content/library/alikins.testing-content ]
# [ -d ~/.ansible/content/${PACKAGE}/library/alikins.testing-content ]
# install modules from a scm url
rm -rf ~/.ansible/content
mazer install -t module git+https://github.com/atestuseraccount/ansible-testing-content.git
mazer install --namespace atestuseraccount -t module git+https://github.com/atestuseraccount/ansible-testing-content.git
tree ~/.ansible/content
# install an apb archive from galaxy
rm -rf ~/.ansible/content
mazer install alikins.mssql-apb
tree ~/.ansible/content
[ -d ~/.ansible/content/apbs ]
NAMESPACE='alikins'
NAME='mssql-apb'
PACKAGE="${NAMESPACE}.${NAME}"
[ -d ~/.ansible/content/${PACKAGE}/apbs ]
# should dir be mssql or mssql-apb? apb.yml name: is mssql-apb
[ -d ~/.ansible/content/apbs/mssql-apb ]
[ -d ~/.ansible/content/${PACKAGE}/apbs/mssql-apb ]
# install just roles from an apb archive from galaxy
rm -rf ~/.ansible/content
mazer install -t role alikins.mssql-apb
tree ~/.ansible/content
[ -d ~/.ansible/content/roles ]
[ -d ~/.ansible/content/roles/deprovision-mssql-apb ]
NAMESPACE='alikins'
NAME='mssql-apb'
PACKAGE="${NAMESPACE}.${NAME}"
[ -d ~/.ansible/content/${PACKAGE}/roles ]
[ -d ~/.ansible/content/${PACKAGE}/roles/deprovision-mssql-apb ]
# install to a diff dir via --content-path from scm
CONTENT_DIR=$(mktemp -d)
mazer install --content-path "${CONTENT_DIR}" git+https://github.com/atestuseraccount/ansible-testing-content.git
mazer install --namespace atestuseraccount --content-path "${CONTENT_DIR}" git+https://github.com/atestuseraccount/ansible-testing-content.git
tree "${CONTENT_DIR}"
rm -rf "${CONTENT_DIR}"
@@ -177,32 +191,41 @@ exit 0
rm -rf ~/.ansible/content
mazer install alikins.test-galaxy-content-galaxyfile
tree ~/.ansible/content
[ -d ~/.ansible/content/library ]
[ -f ~/.ansible/content/library/module_c.py ]
[ -f ~/.ansible/content/library/galaxyfile_sample_module.py ]
[ -f ~/.ansible/content/library/galaxyfile_playbook_sample_module.py ]
[ ! -e ~/.ansible/content/README.md ]
NAMESPACE='alikins'
NAME='test-galaxy-content-galaxyfile'
PACKAGE="${NAMESPACE}.${NAME}"
[ -d ~/.ansible/content/${PACKAGE}/library ]
[ -f ~/.ansible/content/${PACKAGE}/library/module_c.py ]
[ -f ~/.ansible/content/${PACKAGE}/library/galaxyfile_sample_module.py ]
[ -f ~/.ansible/content/${PACKAGE}/library/galaxyfile_playbook_sample_module.py ]
[ ! -e ~/.ansible/content/${PACKAGE}/README.md ]
# not yet
# [ -f ~/.ansible/content/library/.galaxy_install_info ]
# [ -f ~/.ansible/content/${PACKAGE}/library/.galaxy_install_info ]
# TODO: start converting to a test script
ls -lart ~/.ansible/content/roles/alikins.testing-content
# grep role_name ~/.ansible/content/roles/alikins.testing-content/meta/main.yml
# ~/.ansible/content/roles/.galaxy_install_info
ls -lart ~/.ansible/content/${PACKAGE}/roles/alikins.testing-content
# grep role_name ~/.ansible/content/${PACKAGE}/roles/alikins.testing-content/meta/main.yml
# ~/.ansible/content/${PACKAGE}/roles/.galaxy_install_info
# install 'all' from a multi-content repo
rm -rf ~/.ansible/content
mazer install alikins.ansible-testing-content
tree ~/.ansible/content
[ -d ~/.ansible/content/roles ]
NAMESPACE='alikins'
NAME='ansible-testing-content'
PACKAGE="${NAMESPACE}.${NAME}"
[ -d ~/.ansible/content/${PACKAGE}/roles ]
# install all modules
mazer install -t module testing.ansible-testing-content
tree ~/.ansible/content
[ -d ~/.ansible/content/roles ]
NAMESPACE='testing'
NAME='ansible-testing-content'
PACKAGE="${NAMESPACE}.${NAME}"
[ -d ~/.ansible/content/${PACKAGE}/roles ]
exit 0
@@ -271,22 +294,25 @@ mazer install git+https://github.com/geerlingguy/ansible-role-awx.git,version=1.
# The name of the subdirectory containing each installed role matches the Galaxy server naming convention of namespace.role_name.
# The path to each installed role is ~/.ansible/content/roles/atestuseraccount.<role_name>.
# The path to each installed role is ~/.ansible/content/${PACKAGE}/roles/atestuseraccount.<role_name>.
# The role ansible-test-role-1 has a role_name value of testing-role set in meta/main.yml, and will be installed to the directory ~/.ansible/content/roles/atestuseraccount.testing-role
# Following the default role naming conventions, the role ansible-role-foobar will be installed to the directory ~/.ansible/content/roles/atestuseraccount.foobar
# Following the default role naming conventions, the role ansible-role-foobar will be installed to the directory ~/.ansible/content/${PACKAGE}/roles/atestuseraccount.foobar
# The ~/.ansible/content/roles/.galaxy_install_info contains an entry for each role, and for each, the version reflects the latest version found in the repository, which at the time of this writing is 1.1.0.
# The ~/.ansible/content/${PACKAGE}/roles/.galaxy_install_info contains an entry for each role, and for each, the version reflects the latest version found in the repository, which at the time of this writing is 1.1.0.
mazer install -t role alikins.testing-content
RC=$?
# TODO: start converting to a test script
ls -lart ~/.ansible/content/roles/alikins.testing-content
grep role_name ~/.ansible/content/roles/alikins.testing-content/meta/main.yml
~/.ansible/content/roles/.galaxy_install_info
NAMESPACE='alikins'
NAME='testing-content'
PACKAGE="${NAMESPACE}.${NAME}"
ls -lart ~/.ansible/content/${PACKAGE}/roles/alikins.testing-content
grep role_name ~/.ansible/content/${PACKAGE}/roles/alikins.testing-content/meta/main.yml
~/.ansible/content/${PACKAGE}/roles/.galaxy_install_info
# Here we use the SCM+URL convention to install the latest version of all roles:
mazer install -t role git+https://atestuseraccount/ansible-testing-content.git