Skip to content

Commit

Permalink
update missing_file_test test scenarios of file_groupownership and fi…
Browse files Browse the repository at this point in the history
…le_owner template

These test scenarios would not work correctly if the filepath parameter was a directory.
  • Loading branch information
vojtapolasek committed Jun 13, 2023
1 parent 7ddcdc0 commit cb15519
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

{{% for path in FILEPATH %}}
{{% if MISSING_FILE_PASS %}}
{{% if path.endswith("/") %}}
{{% if FILE_REGEX %}}
echo "Create specific tests for this rule because of regex"
{{% else %}}
rm -rf {{{ path }}}
{{% endif %}}
{{% else %}}
rm -f {{{ path }}}
{{% endif %}}
{{% else %}}
{{% if path.endswith("/") %}}
if [ ! -d {{{ path }}} ]; then
Expand Down
10 changes: 9 additions & 1 deletion shared/templates/file_owner/tests/missing_file_test.pass.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@

{{% for path in FILEPATH %}}
{{% if MISSING_FILE_PASS %}}
{{% if path.endswith("/") %}}
{{% if FILE_REGEX %}}
echo "Create specific tests for this rule because of regex"
{{% else %}}
rm -rf {{{ path }}}
{{% endif %}}
{{% else %}}
rm -f {{{ path }}}
{{% else %}}
{{% endif %}}
{{% else %}}
{{% if path.endswith("/") %}}
if [ ! -d {{{ path }}} ]; then
mkdir -p {{{ path }}}
Expand Down

0 comments on commit cb15519

Please sign in to comment.