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/test_rm.py::test_secure_delete_capability on Focal #5601

Closed
kushaldas opened this issue Oct 28, 2020 · 2 comments · Fixed by #5602
Closed

tests/test_rm.py::test_secure_delete_capability on Focal #5601

kushaldas opened this issue Oct 28, 2020 · 2 comments · Fixed by #5602

Comments

@kushaldas
Copy link
Contributor

Description

The test_rm.py is failing.

Steps to Reproduce

  • BASE_OS=focal securedrop/bin/dev-shell bin/run-test -s -v tests/test_rm.py

Expected Behavior

All tests should pass.

Actual Behavior

===Flaky Test Report===                                                                                                                                                                                             
                                                                                                                                                                                                                    
test_secure_delete_capability failed (2 runs remaining out of 3).
        <class 'AssertionError'>
        assert True is False
 +  where True = <function check_secure_delete_capability at 0x7fa81888bee0>()
 +    where <function check_secure_delete_capability at 0x7fa81888bee0> = rm.check_secure_delete_capability                                                                                                        
        [<TracebackEntry /root/code/securedrop/securedrop/tests/test_rm.py:17>]
test_secure_delete_capability failed (1 runs remaining out of 3).
        <class 'AssertionError'>
        assert True is False
 +  where True = <function check_secure_delete_capability at 0x7fa81888bee0>()
 +    where <function check_secure_delete_capability at 0x7fa81888bee0> = rm.check_secure_delete_capability                                                                                                        
        [<TracebackEntry /root/code/securedrop/securedrop/tests/test_rm.py:17>]
test_secure_delete_capability failed; it passed 0 out of the required 1 times.
        <class 'AssertionError'>
        assert True is False
 +  where True = <function check_secure_delete_capability at 0x7fa81888bee0>()
 +    where <function check_secure_delete_capability at 0x7fa81888bee0> = rm.check_secure_delete_capability                                                                                                        
        [<TracebackEntry /root/code/securedrop/securedrop/tests/test_rm.py:17>]
@kushaldas
Copy link
Contributor Author

If I add a print call and one after the subprocess call in the code, I can see all of them executing properly. Wondering how the test is actually failing.

tests/test_rm.py::test_secure_delete_capability main: /tmp/pytest-of-www-data/pytest-0/test_secure_delete_capability0/data/db.sqlite
before call                                                                                                                                                                                                         
after call                                                                               
before call                                                                                                                                                                                                         
after call                                                                                            
main: /tmp/pytest-of-www-data/pytest-0/test_secure_delete_capability1/data/db.sqlite
before call                                                                    
after call                                                                                                                                                                                                          
before call                                                                                                                                                                                                        
after call                                                                                                                                                                                                          
main: /tmp/pytest-of-www-data/pytest-0/test_secure_delete_capability2/data/db.sqlite                   
before call                                                                                 
after call                                                                                      
before call
after call
FAILED
diff --git a/securedrop/rm.py b/securedrop/rm.py
index d9e083d19..baf1a8c94 100644
--- a/securedrop/rm.py
+++ b/securedrop/rm.py
@@ -93,7 +93,9 @@ def check_secure_delete_capability() -> bool:
         bool: True if the program is available, otherwise False.
     """
     try:
+        print("before call")
         subprocess.check_output(["shred", "--help"])
+        print("after call")
         return True
     except EnvironmentError as e:
         if e.errno != errno.ENOENT:
@@ -101,4 +103,6 @@ def check_secure_delete_capability() -> bool:
         logging.error("The shred utility is missing.")
     except subprocess.CalledProcessError as e:
         logging.error("The shred utility is broken: %s %s", e, e.output)
+    except:
+        logging.error("The shred utility is crying: %s %s", e, e.output)
     return False

@kushaldas
Copy link
Contributor Author

Now I realized, this code will keep doing the right thing, as in Focal the /bin/shred just works.

kushaldas added a commit that referenced this issue Oct 28, 2020
On Focal `/bin/shred` exists, that was reason for the failure. `/sbin`
does not contain the `shred` executable in both Xenial and Focal.
@rmol rmol closed this as completed in #5602 Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant