ansible-playbook-bundle icon indicating copy to clipboard operation
ansible-playbook-bundle copied to clipboard

need unit tests

Open jmrodri opened this issue 8 years ago • 5 comments

Need to add nose unit tests.

jmrodri avatar Jun 26 '17 02:06 jmrodri

@jmrodri What will be tested in nose tests? Can you write them out here so we can track the work.

rthallisey avatar Jun 26 '17 11:06 rthallisey

  • add test/test_cli.py
    • test subcmd_list_parser(subcmd) verify proper output, and handling of errors
    • test subcmd_build_parser(subcmd) verify proper output, and handling of errors
    • test subcmd_init_parser(subcmd) verify proper output, and handling of errors
    • test subcmd_prepare_parser(subcmd) verify proper output, and handling of errors
    • test subcmd_push_parser(subcmd) verify proper output, and handling of errors
    • test subcmd_remove_parser(subcmd) verify proper output, and handling of errors
    • test subcmd_bootstrap_parser(subcmd) verify proper output, and handling of errors
    • test subcmd_help_parser(subcmd) verify proper output, and handling of errors
    • test main() verify proper output, and handling of errors
  • add test/test_engine.py
    • test load_dockerfile(df_path) verify proper output, and handling of errors
    • test convert_params_to_dict(params) verify proper output, and handling of errors
    • test `load_example_specfile(apb_dict, verify proper output, and handling of errors
    • test `write_file(file_out, verify proper output, and handling of errors
    • test `insert_encoded_spec(dockerfile, verify proper output, and handling of errors
    • test mkdir_p(path) verify proper output, and handling of errors
    • test `write_playbook(project_dir, verify proper output, and handling of errors
    • test `write_role(project_path, verify proper output, and handling of errors
    • test `generate_playbook_files(project_path, verify proper output, and handling of errors
    • test `gen_spec_id(spec, verify proper output, and handling of errors
    • test is_valid_spec(spec) verify proper output, and handling of errors
    • test load_spec_dict(spec_path) verify proper output, and handling of errors
    • test load_spec_str(spec_path) verify proper output, and handling of errors
    • test `get_spec(project, verify proper output, and handling of errors
    • test make_friendly(blob) verify proper output, and handling of errors
    • test `touch(fname, verify proper output, and handling of errors
    • test `update_spec(project, verify proper output, and handling of errors
    • test update_dockerfile(project) verify proper output, and handling of errors
    • test load_source_dependencies(roles_path) verify proper output, and handling of errors
    • test get_asb_route() verify proper output, and handling of errors
    • test `broker_request(broker, verify proper output, and handling of errors
    • test cmdrun_list(**kwargs) verify proper output, and handling of errors
    • test cmdrun_init(**kwargs) verify proper output, and handling of errors
    • test cmdrun_prepare(**kwargs) verify proper output, and handling of errors
    • test cmdrun_build(**kwargs) verify proper output, and handling of errors
    • test cmdrun_push(**kwargs) verify proper output, and handling of errors
    • test cmdrun_remove(**kwargs) verify proper output, and handling of errors
    • test cmdrun_bootstrap(**kwargs) verify proper output, and handling of errors

jmrodri avatar Jul 28 '17 13:07 jmrodri

Scripts to generate output for above comment:

grep def engine.py | grep -v SPEC_FILE_PARAM | sed 's/def /test `/'  | sed 's/:$/`/g' | awk '{print "  * "$1" "$2" verify proper output, and handling of errors"}'
grep def cli.py | grep -v SPEC_FILE_PARAM | sed 's/def /test `/'  | sed 's/:$/`/g' | awk '{print "  * "$1" "$2" verify proper output, and handling of errors"}'

jmrodri avatar Jul 28 '17 13:07 jmrodri

Given apb rpm is doa on fedora distro (e.g. #78), I think this needs to happen ASAP so contributors and release engineers have some confidence in the codebase.

aweiteka avatar Jul 31 '17 15:07 aweiteka

First steps towards this: https://github.com/fusor/ansible-playbook-bundle/pull/101

jdob avatar Aug 23 '17 19:08 jdob