diff options
author | Jay Doane <jaydoane@apache.org> | 2022-10-11 12:04:36 -0700 |
---|---|---|
committer | Jay Doane <jay.s.doane@gmail.com> | 2022-10-11 15:31:37 -0700 |
commit | 3dbb903527ccffc5ff8b4f72a2e79f4a2aba193a (patch) | |
tree | 7ab94d1a7a161ba318175deaa46401a8e36c5b65 | |
parent | 4583c69b419b3532ffabdd27c504a4ee02bcfda7 (diff) | |
download | couchdb-3dbb903527ccffc5ff8b4f72a2e79f4a2aba193a.tar.gz |
Quiet jwtf keystore test noise
These tests emit a lot of unnecessary noise because they start the
`couch_log` application without also starting `folsom`:
❯ make eunit apps=jwtf suites=jwtf_keystore_tests
==> jwtf (compile)
==> rel (compile)
==> couchdb (compile)
WARN: Missing plugins: [pc]
WARN: Missing plugins: [covertool]
==> couchdb (setup_eunit)
==> jwtf (eunit)
======================== EUnit ========================
module 'jwtf_keystore_tests'
[notice] 2022-10-11T19:01:50.047710Z nonode@nohost <0.190.0> -------- config: [jwt_keys] hmac:hmac set to aGVsbG8= for reason nil
[error] 2022-10-11T19:01:50.047718Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[error] 2022-10-11T19:01:50.068427Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[notice] 2022-10-11T19:01:50.068494Z nonode@nohost <0.190.0> -------- config: [jwt_keys] rsa:hmac set to aGVsbG8= for reason nil
[error] 2022-10-11T19:01:50.068501Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[error] 2022-10-11T19:01:50.068505Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[notice] 2022-10-11T19:01:50.068527Z nonode@nohost <0.190.0> -------- config: [jwt_keys] ec:hmac set to aGVsbG8= for reason nil
[error] 2022-10-11T19:01:50.068533Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[error] 2022-10-11T19:01:50.068536Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[error] 2022-10-11T19:01:50.068587Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[error] 2022-10-11T19:01:50.068592Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[notice] 2022-10-11T19:01:50.068595Z nonode@nohost <0.190.0> -------- config: [jwt_keys] hmac:rsa set to -----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAztanwQtIx0sms+x7m1SF\nh7EHJHkM2biTJ41jR89FsDE2gd3MChpaqxemS5GpNvfFKRvuHa4PUZ3JtRCBG1KM\n/7EWIVTy1JQDr2mb8couGlQNqz4uXN2vkNQ0XszgjU4Wn6ZpvYxmqPFbmkRe8QSn\nAy2Wf8jQgjsbez8eaaX0G9S1hgFZUN3KFu7SVmUDQNvWpQdaJPP+ms5Z0CqF7JLa\nvJmSdsU49nlYw9VH/XmwlUBMye6HgR4ZGCLQS85frqF0xLWvi7CsMdchcIjHudXH\nQK1AumD/VVZVdi8Q5Qew7F6VXeXqnhbw9n6Px25cCuNuh6u5+E6GUzXRrMpqo9vO\nqQIDAQAB\n-----END PUBLIC KEY-----\n for reason nil
[error] 2022-10-11T19:01:50.068647Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[error] 2022-10-11T19:01:50.068654Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[notice] 2022-10-11T19:01:50.068661Z nonode@nohost <0.190.0> -------- config: [jwt_keys] rsa:rsa set to -----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAztanwQtIx0sms+x7m1SF\nh7EHJHkM2biTJ41jR89FsDE2gd3MChpaqxemS5GpNvfFKRvuHa4PUZ3JtRCBG1KM\n/7EWIVTy1JQDr2mb8couGlQNqz4uXN2vkNQ0XszgjU4Wn6ZpvYxmqPFbmkRe8QSn\nAy2Wf8jQgjsbez8eaaX0G9S1hgFZUN3KFu7SVmUDQNvWpQdaJPP+ms5Z0CqF7JLa\nvJmSdsU49nlYw9VH/XmwlUBMye6HgR4ZGCLQS85frqF0xLWvi7CsMdchcIjHudXH\nQK1AumD/VVZVdi8Q5Qew7F6VXeXqnhbw9n6Px25cCuNuh6u5+E6GUzXRrMpqo9vO\nqQIDAQAB\n-----END PUBLIC KEY-----\n for reason nil
[error] 2022-10-11T19:01:50.068705Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[error] 2022-10-11T19:01:50.068709Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[notice] 2022-10-11T19:01:50.068712Z nonode@nohost <0.190.0> -------- config: [jwt_keys] ec:rsa set to -----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAztanwQtIx0sms+x7m1SF\nh7EHJHkM2biTJ41jR89FsDE2gd3MChpaqxemS5GpNvfFKRvuHa4PUZ3JtRCBG1KM\n/7EWIVTy1JQDr2mb8couGlQNqz4uXN2vkNQ0XszgjU4Wn6ZpvYxmqPFbmkRe8QSn\nAy2Wf8jQgjsbez8eaaX0G9S1hgFZUN3KFu7SVmUDQNvWpQdaJPP+ms5Z0CqF7JLa\nvJmSdsU49nlYw9VH/XmwlUBMye6HgR4ZGCLQS85frqF0xLWvi7CsMdchcIjHudXH\nQK1AumD/VVZVdi8Q5Qew7F6VXeXqnhbw9n6Px25cCuNuh6u5+E6GUzXRrMpqo9vO\nqQIDAQAB\n-----END PUBLIC KEY-----\n for reason nil
[notice] 2022-10-11T19:01:50.068739Z nonode@nohost <0.190.0> -------- config: [jwt_keys] hmac:ec set to -----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEDsr0lz/Dg3luarb+Kua0Wcj9WrfR23os\nwHzakglb8GhWRDn+oZT0Bt/26sX8uB4/ij9PEOLHPo+IHBtX4ELFFVr5GTzlqcJe\nyctaTDd1OOAPXYuc67EWtGZ3pDAzztRs\n-----END PUBLIC KEY-----\n for reason nil
[error] 2022-10-11T19:01:50.068771Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
jwtf_keystore_tests:49: -jwtf_keystore_test_/0-fun-17-...[error] 2022-10-11T19:01:50.068786Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[notice] 2022-10-11T19:01:50.068855Z nonode@nohost <0.190.0> -------- config: [jwt_keys] rsa:ec set to -----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEDsr0lz/Dg3luarb+Kua0Wcj9WrfR23os\nwHzakglb8GhWRDn+oZT0Bt/26sX8uB4/ij9PEOLHPo+IHBtX4ELFFVr5GTzlqcJe\nyctaTDd1OOAPXYuc67EWtGZ3pDAzztRs\n-----END PUBLIC KEY-----\n for reason nil
[error] 2022-10-11T19:01:50.068863Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[error] 2022-10-11T19:01:50.068866Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[notice] 2022-10-11T19:01:50.068903Z nonode@nohost <0.190.0> -------- config: [jwt_keys] ec:ec set to -----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEDsr0lz/Dg3luarb+Kua0Wcj9WrfR23os\nwHzakglb8GhWRDn+oZT0Bt/26sX8uB4/ij9PEOLHPo+IHBtX4ELFFVr5GTzlqcJe\nyctaTDd1OOAPXYuc67EWtGZ3pDAzztRs\n-----END PUBLIC KEY-----\n for reason nil
[error] 2022-10-11T19:01:50.068908Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[error] 2022-10-11T19:01:50.068912Z nonode@nohost <0.190.0> -------- unknown metric: [couch_log,level,notice]
[0.021 s] ok
jwtf_keystore_tests:50: -jwtf_keystore_test_/0-fun-15-...[0.056 s] ok
jwtf_keystore_tests:51: -jwtf_keystore_test_/0-fun-13-...ok
jwtf_keystore_tests:53: -jwtf_keystore_test_/0-fun-11-...ok
jwtf_keystore_tests:54: -jwtf_keystore_test_/0-fun-9-...[0.102 s] ok
jwtf_keystore_tests:55: -jwtf_keystore_test_/0-fun-7-...ok
jwtf_keystore_tests:57: -jwtf_keystore_test_/0-fun-5-...ok
jwtf_keystore_tests:58: -jwtf_keystore_test_/0-fun-3-...ok
jwtf_keystore_tests:59: -jwtf_keystore_test_/0-fun-1-...ok
[info] 2022-10-11T19:01:50.275122Z nonode@nohost <0.44.0> -------- Application jwtf exited with reason: stopped
[info] 2022-10-11T19:01:50.275139Z nonode@nohost <0.44.0> -------- Application jwtf exited with reason: stopped
[done in 0.206 s]
=======================================================
All 9 tests passed.
This changes the tests to simply mock the one function of `couch_log`
used by `config`, suppressing the noise, and speeding up the test.
-rw-r--r-- | src/jwtf/test/jwtf_keystore_tests.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/jwtf/test/jwtf_keystore_tests.erl b/src/jwtf/test/jwtf_keystore_tests.erl index c05d7f1b4..8229ec0f8 100644 --- a/src/jwtf/test/jwtf_keystore_tests.erl +++ b/src/jwtf/test/jwtf_keystore_tests.erl @@ -24,7 +24,8 @@ ). setup() -> - test_util:start_applications([couch_log, config, jwtf]), + meck:expect(couch_log, notice, 2, fun(_, _) -> ok end), + test_util:start_applications([config, jwtf]), config:set("jwt_keys", "hmac:hmac", ?HMAC_SECRET), config:set("jwt_keys", "rsa:hmac", ?HMAC_SECRET), config:set("jwt_keys", "ec:hmac", ?HMAC_SECRET), @@ -38,7 +39,8 @@ setup() -> config:set("jwt_keys", "ec:ec", ?EC_SECRET). teardown(_) -> - test_util:stop_applications([couch_log, config, jwtf]). + test_util:stop_applications([config, jwtf]), + meck:unload(). jwtf_keystore_test_() -> { |