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

gpg unit test takes a long time #4504

Closed
krafczyk opened this issue Jun 14, 2017 · 13 comments · Fixed by #6483
Closed

gpg unit test takes a long time #4504

krafczyk opened this issue Jun 14, 2017 · 13 comments · Fixed by #6483
Assignees
Labels
tests General test capability(ies)

Comments

@krafczyk
Copy link
Contributor

I'm trying to run the unit test suite right now, and the gpg test takes forever. is this normal? Am I missing some python module to make it run faster?

@adamjstewart adamjstewart added the tests General test capability(ies) label Jun 14, 2017
@adamjstewart
Copy link
Member

How long does it take you to run? On my laptop, I'm seeing under 7 seconds:

$ spack test gpg
==================================== test session starts =====================================
platform linux2 -- Python 2.7.13, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/ajstewart/spack, inifile: pytest.ini
collected 746 items 

lib/spack/spack/test/cmd/gpg.py .

================================= slowest 20 test durations ==================================
4.57s call     lib/spack/spack/test/cmd/gpg.py::test_gpg
0.00s setup    lib/spack/spack/test/cmd/gpg.py::test_gpg
0.00s teardown lib/spack/spack/test/cmd/gpg.py::test_gpg
==================================== 745 tests deselected ====================================
========================== 1 passed, 745 deselected in 6.53 seconds ==========================

@krafczyk
Copy link
Contributor Author

It takes 2 minutes for me.

spack test gpg
====================================== test session starts ======================================
platform linux -- Python 3.6.1, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/matthew/Software/NCSA/Vertical/spack/spack-dev, inifile: pytest.ini
collected 746 items 

lib/spack/spack/test/cmd/gpg.py .

=================================== slowest 20 test durations ===================================
126.92s call     lib/spack/spack/test/cmd/gpg.py::test_gpg
0.00s setup    lib/spack/spack/test/cmd/gpg.py::test_gpg
0.00s teardown lib/spack/spack/test/cmd/gpg.py::test_gpg
===================================== 745 tests deselected ======================================
========================== 1 passed, 745 deselected in 127.30 seconds ===========================

@adamjstewart
Copy link
Member

Do you have gpg installed on your system?

$ which gpg
/usr/bin/gpg

I bet there's a Python module that wraps around the system utility if present otherwise runs a Python version which is slower.

@krafczyk
Copy link
Contributor Author

Yep, I have gpg.

which gpg
/usr/bin/gpg

@adamjstewart
Copy link
Member

@mathstuf?

@adamjstewart
Copy link
Member

adamjstewart commented Jun 14, 2017

@alalazo I forget, how do I run spack test and view the output?

EDIT: Nevermind, found it. It's spack test -k gpg -s

@adamjstewart
Copy link
Member

@krafczyk Can you post the output of your tests? It successfully completes for me on my Fedora 25 laptop:

$ spack test -k gpg -s
=========================================================== test session starts ============================================================
platform linux2 -- Python 2.7.13, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/ajstewart/spack, inifile: pytest.ini
collected 746 items 

lib/spack/spack/test/cmd/gpg.py gpg: keybox '/tmp/pytest-of-ajstewart/pytest-2/test_gpg0/gpg/pubring.kbx' created
gpg: Signature made Mon 08 May 2017 01:27:22 PM CDT using RSA key ID DCA0241840A5DAE2
gpg: Can't check signature: No public key
gpg: /tmp/pytest-of-ajstewart/pytest-2/test_gpg0/gpg/trustdb.gpg: trustdb created
gpg: key DCA0241840A5DAE2: public key "Spack testing (Spack testing key) <spack@googlegroups.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
/tmp/pytest-of-ajstewart/pytest-2/test_gpg0/gpg/pubring.kbx
-----------------------------------------------------------
pub   rsa4096 2017-05-08 [SC]
      B27095DEEF1787C3C8C85917DCA0241840A5DAE2
uid           [ unknown] Spack testing (Spack testing key) <spack@googlegroups.com>

gpg: Signature made Mon 08 May 2017 01:27:22 PM CDT using RSA key ID DCA0241840A5DAE2
gpg: Good signature from "Spack testing (Spack testing key) <spack@googlegroups.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: B270 95DE EF17 87C3 C8C8  5917 DCA0 2418 40A5 DAE2
gpg: Signature made Mon 08 May 2017 01:27:22 PM CDT using RSA key ID DCA0241840A5DAE2
gpg: Can't check signature: No public key
gpg: key 8F65F3629802D1EA marked as ultimately trusted
gpg: directory '/tmp/pytest-of-ajstewart/pytest-2/test_gpg0/gpg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/tmp/pytest-of-ajstewart/pytest-2/test_gpg0/gpg/openpgp-revocs.d/747D5F5B6E4A5ED1A9D8B6768F65F3629802D1EA.rev'
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
/tmp/pytest-of-ajstewart/pytest-2/test_gpg0/gpg/pubring.kbx
-----------------------------------------------------------
pub   rsa4096 2017-06-14 [SC]
      747D5F5B6E4A5ED1A9D8B6768F65F3629802D1EA
uid           [ultimate] Spack testing 1 (Spack testing key) <spack@googlegroups.com>

/tmp/pytest-of-ajstewart/pytest-2/test_gpg0/gpg/pubring.kbx
-----------------------------------------------------------
sec   rsa4096 2017-06-14 [SC]
      747D5F5B6E4A5ED1A9D8B6768F65F3629802D1EA
uid           [ultimate] Spack testing 1 (Spack testing key) <spack@googlegroups.com>

gpg: using "747D5F5B6E4A5ED1A9D8B6768F65F3629802D1EA" as default secret key for signing
gpg: Signature made Wed 14 Jun 2017 03:25:39 PM CDT using RSA key ID 8F65F3629802D1EA
gpg: Good signature from "Spack testing 1 (Spack testing key) <spack@googlegroups.com>" [ultimate]
gpg: key 95F09E123A3D1CDE marked as ultimately trusted
gpg: revocation certificate stored as '/tmp/pytest-of-ajstewart/pytest-2/test_gpg0/gpg/openpgp-revocs.d/40204A47B02A6E6A54C0155C95F09E123A3D1CDE.rev'
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   2  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 2u
/tmp/pytest-of-ajstewart/pytest-2/test_gpg0/gpg/pubring.kbx
-----------------------------------------------------------
pub   rsa4096 2017-06-14 [SC]
      747D5F5B6E4A5ED1A9D8B6768F65F3629802D1EA
uid           [ultimate] Spack testing 1 (Spack testing key) <spack@googlegroups.com>

pub   rsa4096 2017-06-14 [SC]
      40204A47B02A6E6A54C0155C95F09E123A3D1CDE
uid           [ultimate] Spack testing 2 (Spack testing key) <spack@googlegroups.com>

/tmp/pytest-of-ajstewart/pytest-2/test_gpg0/gpg/pubring.kbx
-----------------------------------------------------------
sec   rsa4096 2017-06-14 [SC]
      747D5F5B6E4A5ED1A9D8B6768F65F3629802D1EA
uid           [ultimate] Spack testing 1 (Spack testing key) <spack@googlegroups.com>

sec   rsa4096 2017-06-14 [SC]
      40204A47B02A6E6A54C0155C95F09E123A3D1CDE
uid           [ultimate] Spack testing 2 (Spack testing key) <spack@googlegroups.com>

gpg: using "747D5F5B6E4A5ED1A9D8B6768F65F3629802D1EA" as default secret key for signing
gpg: there is a secret key for public key "Spack testing 1"!
gpg: use option "--delete-secret-keys" to delete it first.
gpg: Signature made Wed 14 Jun 2017 03:25:41 PM CDT using RSA key ID 8F65F3629802D1EA
gpg: Can't check signature: No public key
gpg: key 8F65F3629802D1EA: public key "Spack testing 1 (Spack testing key) <spack@googlegroups.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: Signature made Wed 14 Jun 2017 03:25:41 PM CDT using RSA key ID 8F65F3629802D1EA
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: Good signature from "Spack testing 1 (Spack testing key) <spack@googlegroups.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 747D 5F5B 6E4A 5ED1 A9D8  B676 8F65 F362 9802 D1EA
.

======================================================== slowest 20 test durations =========================================================
5.52s call     lib/spack/spack/test/cmd/gpg.py::test_gpg
0.00s setup    lib/spack/spack/test/cmd/gpg.py::test_gpg
0.00s teardown lib/spack/spack/test/cmd/gpg.py::test_gpg
=========================================================== 745 tests deselected ===========================================================
================================================= 1 passed, 745 deselected in 6.27 seconds =================================================

but hangs forever on our CentOS 6 cluster:

$ spack test -k gpg -s
=========================================================== test session starts ============================================================
platform linux2 -- Python 2.7.13, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /blues/gpfs/home/ajstewart/spack, inifile: pytest.ini
collected 746 items 

lib/spack/spack/test/cmd/gpg.py gpg: keyring `/tmp/pytest-of-ajstewart/pytest-5/test_gpg0/gpg/pubring.gpg' created
gpg: Signature made Mon 08 May 2017 01:27:22 PM CDT using RSA key ID 40A5DAE2
gpg: Can't check signature: No public key
gpg: keyring `/tmp/pytest-of-ajstewart/pytest-5/test_gpg0/gpg/secring.gpg' created
gpg: /tmp/pytest-of-ajstewart/pytest-5/test_gpg0/gpg/trustdb.gpg: trustdb created
gpg: key 40A5DAE2: public key "Spack testing (Spack testing key) <spack@googlegroups.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
/tmp/pytest-of-ajstewart/pytest-5/test_gpg0/gpg/pubring.gpg
-----------------------------------------------------------
pub   4096R/40A5DAE2 2017-05-08
uid                  Spack testing (Spack testing key) <spack@googlegroups.com>

gpg: Signature made Mon 08 May 2017 01:27:22 PM CDT using RSA key ID 40A5DAE2
gpg: Good signature from "Spack testing (Spack testing key) <spack@googlegroups.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: B270 95DE EF17 87C3 C8C8  5917 DCA0 2418 40A5 DAE2
gpg: Signature made Mon 08 May 2017 01:27:22 PM CDT using RSA key ID 40A5DAE2
gpg: Can't check signature: No public key
gpg: skipping control `%no-protection' ()

@krafczyk
Copy link
Contributor Author

Sure:

spack test -k gpg -s
====================================== test session starts ======================================
platform linux -- Python 3.6.1, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/matthew/Software/NCSA/Vertical/spack/spack-dev, inifile: pytest.ini
collected 746 items 

lib/spack/spack/test/cmd/gpg.py gpg: keybox '/tmp/pytest-of-matthew/pytest-2/test_gpg0/gpg/pubring.kbx' created
gpg: Signature made Mon 08 May 2017 01:27:22 PM CDT
gpg:                using RSA key DCA0241840A5DAE2
gpg: Can't check signature: No public key
gpg: /tmp/pytest-of-matthew/pytest-2/test_gpg0/gpg/trustdb.gpg: trustdb created
gpg: key DCA0241840A5DAE2: public key "Spack testing (Spack testing key) <spack@googlegroups.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
/tmp/pytest-of-matthew/pytest-2/test_gpg0/gpg/pubring.kbx
---------------------------------------------------------
pub   rsa4096 2017-05-08 [SC]
      B27095DEEF1787C3C8C85917DCA0241840A5DAE2
uid           [ unknown] Spack testing (Spack testing key) <spack@googlegroups.com>

gpg: Signature made Mon 08 May 2017 01:27:22 PM CDT
gpg:                using RSA key DCA0241840A5DAE2
gpg: Good signature from "Spack testing (Spack testing key) <spack@googlegroups.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: B270 95DE EF17 87C3 C8C8  5917 DCA0 2418 40A5 DAE2
gpg: Signature made Mon 08 May 2017 01:27:22 PM CDT
gpg:                using RSA key DCA0241840A5DAE2
gpg: Can't check signature: No public key
gpg: key EABAAD8ADE09AF12 marked as ultimately trusted
gpg: directory '/tmp/pytest-of-matthew/pytest-2/test_gpg0/gpg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/tmp/pytest-of-matthew/pytest-2/test_gpg0/gpg/openpgp-revocs.d/F91F1C1C51E9E453C475774EEABAAD8ADE09AF12.rev'
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
/tmp/pytest-of-matthew/pytest-2/test_gpg0/gpg/pubring.kbx
---------------------------------------------------------
pub   rsa4096 2017-06-14 [SC]
      F91F1C1C51E9E453C475774EEABAAD8ADE09AF12
uid           [ultimate] Spack testing 1 (Spack testing key) <spack@googlegroups.com>

/tmp/pytest-of-matthew/pytest-2/test_gpg0/gpg/pubring.kbx
---------------------------------------------------------
sec   rsa4096 2017-06-14 [SC]
      F91F1C1C51E9E453C475774EEABAAD8ADE09AF12
uid           [ultimate] Spack testing 1 (Spack testing key) <spack@googlegroups.com>

gpg: using "F91F1C1C51E9E453C475774EEABAAD8ADE09AF12" as default secret key for signing
gpg: Signature made Wed 14 Jun 2017 03:47:08 PM CDT
gpg:                using RSA key F91F1C1C51E9E453C475774EEABAAD8ADE09AF12
gpg: Good signature from "Spack testing 1 (Spack testing key) <spack@googlegroups.com>" [ultimate]
gpg: key 2C56553762A5FA3D marked as ultimately trusted
gpg: revocation certificate stored as '/tmp/pytest-of-matthew/pytest-2/test_gpg0/gpg/openpgp-revocs.d/B94949618E6D96485883A5032C56553762A5FA3D.rev'
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   2  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 2u
/tmp/pytest-of-matthew/pytest-2/test_gpg0/gpg/pubring.kbx
---------------------------------------------------------
pub   rsa4096 2017-06-14 [SC]
      F91F1C1C51E9E453C475774EEABAAD8ADE09AF12
uid           [ultimate] Spack testing 1 (Spack testing key) <spack@googlegroups.com>

pub   rsa4096 2017-06-14 [SC]
      B94949618E6D96485883A5032C56553762A5FA3D
uid           [ultimate] Spack testing 2 (Spack testing key) <spack@googlegroups.com>

/tmp/pytest-of-matthew/pytest-2/test_gpg0/gpg/pubring.kbx
---------------------------------------------------------
sec   rsa4096 2017-06-14 [SC]
      F91F1C1C51E9E453C475774EEABAAD8ADE09AF12
uid           [ultimate] Spack testing 1 (Spack testing key) <spack@googlegroups.com>

sec   rsa4096 2017-06-14 [SC]
      B94949618E6D96485883A5032C56553762A5FA3D
uid           [ultimate] Spack testing 2 (Spack testing key) <spack@googlegroups.com>

gpg: using "F91F1C1C51E9E453C475774EEABAAD8ADE09AF12" as default secret key for signing
gpg: there is a secret key for public key "Spack testing 1"!
gpg: use option "--delete-secret-keys" to delete it first.
gpg: Signature made Wed 14 Jun 2017 03:49:16 PM CDT
gpg:                using RSA key F91F1C1C51E9E453C475774EEABAAD8ADE09AF12
gpg: Can't check signature: No public key
gpg: key EABAAD8ADE09AF12: public key "Spack testing 1 (Spack testing key) <spack@googlegroups.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: Signature made Wed 14 Jun 2017 03:49:16 PM CDT
gpg:                using RSA key F91F1C1C51E9E453C475774EEABAAD8ADE09AF12
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: Good signature from "Spack testing 1 (Spack testing key) <spack@googlegroups.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: F91F 1C1C 51E9 E453 C475  774E EABA AD8A DE09 AF12
.

=================================== slowest 20 test durations ===================================
145.51s call     lib/spack/spack/test/cmd/gpg.py::test_gpg
0.00s setup    lib/spack/spack/test/cmd/gpg.py::test_gpg
0.00s teardown lib/spack/spack/test/cmd/gpg.py::test_gpg
===================================== 745 tests deselected ======================================
========================== 1 passed, 745 deselected in 145.89 seconds ===========================

@mathstuf
Copy link
Contributor

mathstuf commented Jul 6, 2017

The part that takes a long time in the tests is key generation. I suspect the cluster is low on entropy and GPG is blocking on /dev/random or the like. It also seems that %no-protection is newer than the version supported there. What version of gpg do you have (Spack uses /usr/bin/gpg2, not /usr/bin/gpg).

@krafczyk
Copy link
Contributor Author

krafczyk commented Jul 6, 2017

gpg2 --version
gpg (GnuPG) 2.1.21
libgcrypt 1.7.8
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /home/matthew/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

@mathstuf
Copy link
Contributor

mathstuf commented Jul 6, 2017

Hmm, I have 2.1.13 here. The hang and rejection of the option on CentOS6 is interesting, but probably due to it being old and lacking entropy.

FWIW, the test took about 11 minutes here. A second run took 4.5 minutes.

@alalazo
Copy link
Member

alalazo commented Nov 23, 2017

+1 on the number of people hit by this (yesterday it was more than 30 min. on my laptop with gpg2 😱)

@alalazo
Copy link
Member

alalazo commented Nov 23, 2017

@krafczyk I found a good workaround here. If you start rngd, then tests won't take longer for gpg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests General test capability(ies)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants