Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] CA-less testcase fixes #1132

Closed
wants to merge 1 commit into from
Closed

Conversation

Akasurde
Copy link
Member

@Akasurde Akasurde commented Oct 5, 2017

  • Do not copy filenames from negative testcases such as 'does-not-exist'
  • Add interactive 'yes'

Fixes: https://pagure.io/freeipa/issue/7182

Signed-off-by: Abhijeet Kasurde akasurde@redhat.com

@Akasurde
Copy link
Member Author

Akasurde commented Oct 5, 2017

Before ::
Testcase failed

After::

# IPATEST_YAML_CONFIG=/root/mh_cfg.yml ipa-run-tests -v -r a --with-xunit test_integration/test_caless.py -k test_nonexistent_ds_pkcs12_file --junit-xml=test_nonexistent_ds_pkcs12_file.xml
===================================================== test session starts ======================================================
platform linux2 -- Python 2.7.5 -- py-1.4.32 -- pytest-2.7.0 -- /usr/bin/python2
rootdir: /usr/lib/python2.7/site-packages/ipatests/test_integration, inifile:
plugins: multihost, sourceorder
collected 96 items

test_integration/test_caless.py::TestServerInstall::test_nonexistent_ds_pkcs12_file PASSED
test_integration/test_caless.py::TestReplicaInstall::test_nonexistent_ds_pkcs12_file PASSED
test_integration/test_caless.py::TestCertinstall::test_nonexistent_ds_pkcs12_file PASSED

-------------- generated xml file: /usr/lib/python2.7/site-packages/ipatests/test_nonexistent_ds_pkcs12_file.xml ---------------
================================== 93 tests deselected by '-ktest_nonexistent_ds_pkcs12_file' ==================================
========================================== 3 passed, 93 deselected in 754.78 seconds ===========================================

@Akasurde
Copy link
Member Author

Akasurde commented Oct 5, 2017

Before ::
Testcase failed

After::

# IPATEST_YAML_CONFIG=/root/mh_cfg.yml ipa-run-tests -v -r a --with-xunit test_integration/test_caless.py -k test_nonexistent_http_pkcs12_file --junit-xml=test_nonexistent_http_pkcs12_file.xml
===================================================== test session starts ======================================================
platform linux2 -- Python 2.7.5 -- py-1.4.32 -- pytest-2.7.0 -- /usr/bin/python2
rootdir: /usr/lib/python2.7/site-packages/ipatests/test_integration, inifile:
plugins: multihost, sourceorder
collected 96 items

test_integration/test_caless.py::TestServerInstall::test_nonexistent_http_pkcs12_file PASSED
test_integration/test_caless.py::TestReplicaInstall::test_nonexistent_http_pkcs12_file PASSED
test_integration/test_caless.py::TestCertinstall::test_nonexistent_http_pkcs12_file PASSED

------------- generated xml file: /usr/lib/python2.7/site-packages/ipatests/test_nonexistent_http_pkcs12_file.xml --------------
================================= 93 tests deselected by '-ktest_nonexistent_http_pkcs12_file' =================================
========================================== 3 passed, 93 deselected in 739.81 seconds ===========================================

@@ -266,6 +266,10 @@ def prepare_replica(self, _replica_number=0, replica=None, master=None,
tasks.prepare_host(master)
tasks.prepare_host(replica)
for filename in set(files_to_copy):
if filename == 'does_not_exist':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,

I think that this is quite unsafe to hardcode such name.

Wouldn't be better to use:

filepath = os.path.join(self.cert_dir, filename)
if not os.path.exists(filepath):
    logger.info("File '%s' not found, copying to server skipped", filepath)
    continue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds OK to me.

@Akasurde
Copy link
Member Author

Akasurde commented Oct 6, 2017

# IPATEST_YAML_CONFIG=/root/mh_cfg.yml ipa-run-tests -v -r a --with-xunit test_integration/test_caless.py -k test_interactive_missing_http_pkcs_password --junit-xml=test_interactive_missing_http_pkcs_password.xml
===================================================== test session starts =====================================================
platform linux2 -- Python 2.7.5 -- py-1.4.32 -- pytest-2.7.0 -- /usr/bin/python2
rootdir: /usr/lib/python2.7/site-packages/ipatests/test_integration, inifile:
plugins: multihost, sourceorder
collected 96 items

test_integration/test_caless.py::TestServerInstall::test_interactive_missing_http_pkcs_password PASSED
test_integration/test_caless.py::TestReplicaInstall::test_interactive_missing_http_pkcs_password PASSED
test_integration/test_caless.py::TestCertinstall::test_interactive_missing_http_pkcs_password PASSED

-------- generated xml file: /usr/lib/python2.7/site-packages/ipatests/test_interactive_missing_http_pkcs_password.xml --------
=========================== 93 tests deselected by '-ktest_interactive_missing_http_pkcs_password' ============================
========================================= 3 passed, 93 deselected in 1267.27 seconds ==========================================
# IPATEST_YAML_CONFIG=/root/mh_cfg.yml ipa-run-tests -v -r a --with-xunit test_integration/test_caless.py -k test_interactive_missing_ds_pkcs_password --junit-xml=test_interactive_missing_ds_pkcs_password.xml
===================================================== test session starts =====================================================
platform linux2 -- Python 2.7.5 -- py-1.4.32 -- pytest-2.7.0 -- /usr/bin/python2
rootdir: /usr/lib/python2.7/site-packages/ipatests/test_integration, inifile:
plugins: multihost, sourceorder
collected 96 items

test_integration/test_caless.py::TestServerInstall::test_interactive_missing_ds_pkcs_password PASSED
test_integration/test_caless.py::TestReplicaInstall::test_interactive_missing_ds_pkcs_password PASSED
test_integration/test_caless.py::TestCertinstall::test_interactive_missing_ds_pkcs_password PASSED

--------- generated xml file: /usr/lib/python2.7/site-packages/ipatests/test_interactive_missing_ds_pkcs_password.xml ---------
============================ 93 tests deselected by '-ktest_interactive_missing_ds_pkcs_password' =============================
========================================= 3 passed, 93 deselected in 1267.75 seconds ==========================================

* Do not copy filenames from negative testcases such as 'does-not-exist'

Partially fixes: https://pagure.io/freeipa/issue/7182

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
@Akasurde
Copy link
Member Author

Akasurde commented Oct 9, 2017

ready_for_review

@stlaz
Copy link
Contributor

stlaz commented Oct 10, 2017

It's not clear what you're trying to fix in this PR. I see failing and passing tests in some of your local runs which does not really help anything. Could you explain what you're doing here?

@Akasurde
Copy link
Member Author

@stlaz I am fixing four failing testcases

  1. test_nonexistent_ds_pkcs12_file
  2. test_nonexistent_http_pkcs12_file

These testcases are failing as they are trying to copy non-existent file to system under tests. So I am checking if file exists on controller node then only copy that file to system under tests.

  1. test_interactive_missing_ds_pkcs_password
  2. test_interactive_missing_http_pkcs_password

These testcases are failing as they are missing one interactive prompt in ipa-replica-install command. So I am adding new "yes" to that interactive prompt.

Let me know if it helps.

@Akasurde
Copy link
Member Author

As per comments, closing this PR in-favour of two separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants