Skip to content

Commit

Permalink
ansible sanity for k8s_cp (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
abikouo authored Jul 27, 2021
1 parent c330c7e commit f98469e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion molecule/default/roles/k8scopy/library/k8s_create_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def execute_module(module):
content = ""
count = 0
while len(content) < size:
content += f"This file has been generated using ansible: {count}\n"
content += "This file has been generated using ansible: {0}\n".format(count)
count += 1

with open(path, write_mode) as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ def execute_module(module):
pod_rc, pod_out, pod_err = kubectl_run_from_pod(module)
rc, out, err = module.run_command([module.params.get('local_path')] + args)
if rc == pod_rc and out == pod_out:
module.exit_json(msg=f"{local_path} and {namespace}/{pod}:{file} are same.", rc=rc, stderr=err, stdout=out)
module.exit_json(msg="{0} and {1}/{2}:{3} are same.".format(
local_path, namespace, pod, file
), rc=rc, stderr=err, stdout=out)
result = dict(local=dict(rc=rc, out=out, err=err), remote=dict(rc=pod_rc, out=pod_out, err=pod_err))
module.fail_json(msg=f"{local_path} and {namespace}/{pod}:{file} are same.", **result)
else:
Expand Down
7 changes: 7 additions & 0 deletions tests/sanity/ignore-2.10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,10 @@ tests/unit/module_utils/test_discoverer.py future-import-boilerplate!skip
tests/unit/module_utils/test_discoverer.py metaclass-boilerplate!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py shebang
molecule/default/roles/k8scopy/library/k8s_create_file.py shebang
plugins/modules/k8s_cp.py compile-2.6!skip
plugins/modules/k8s_cp.py compile-2.7!skip
plugins/modules/k8s_cp.py import-2.6!skip
plugins/modules/k8s_cp.py import-2.7!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py compile-2.6!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py compile-2.7!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py compile-3.5!skip
7 changes: 7 additions & 0 deletions tests/sanity/ignore-2.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,10 @@ tests/unit/module_utils/test_discoverer.py future-import-boilerplate!skip
tests/unit/module_utils/test_discoverer.py metaclass-boilerplate!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py shebang
molecule/default/roles/k8scopy/library/k8s_create_file.py shebang
plugins/modules/k8s_cp.py compile-2.6!skip
plugins/modules/k8s_cp.py compile-2.7!skip
plugins/modules/k8s_cp.py import-2.6!skip
plugins/modules/k8s_cp.py import-2.7!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py compile-2.6!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py compile-2.7!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py compile-3.5!skip
4 changes: 4 additions & 0 deletions tests/sanity/ignore-2.12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,7 @@ plugins/modules/k8s_service.py metaclass-boilerplate!skip
plugins/modules/k8s_service.py validate-modules:parameter-type-not-in-doc
plugins/modules/k8s_service.py validate-modules:return-syntax-error
tests/sanity/refresh_ignore_files shebang!skip
plugins/modules/k8s_cp.py compile-2.6!skip
plugins/modules/k8s_cp.py compile-2.7!skip
plugins/modules/k8s_cp.py import-2.6!skip
plugins/modules/k8s_cp.py import-2.7!skip
7 changes: 7 additions & 0 deletions tests/sanity/ignore-2.9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,10 @@ tests/unit/module_utils/test_discoverer.py future-import-boilerplate!skip
tests/unit/module_utils/test_discoverer.py metaclass-boilerplate!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py shebang
molecule/default/roles/k8scopy/library/k8s_create_file.py shebang
plugins/modules/k8s_cp.py compile-2.6!skip
plugins/modules/k8s_cp.py compile-2.7!skip
plugins/modules/k8s_cp.py import-2.6!skip
plugins/modules/k8s_cp.py import-2.7!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py compile-2.6!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py compile-2.7!skip
molecule/default/roles/k8scopy/library/kubectl_file_compare.py compile-3.5!skip

0 comments on commit f98469e

Please sign in to comment.