dbrgn / tealdeer

A very fast implementation of tldr in Rust.
https://dbrgn.github.io/tealdeer/
Apache License 2.0
4.06k stars 123 forks source link

Unit test failed on Windows #328

Closed vidhyasasi closed 1 year ago

vidhyasasi commented 1 year ago

Ran cargo test for testing unit test and two tests failed on a Windows machine.

The error of a cargo test looks like:

''' failures:

---- test_autoupdate_cache stdout ---- thread 'test_autoupdate_cache' panicked at 'Unexpected failure. code-1 stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the `cache_dir` option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" command="C:\\Users\\Administrator\\Documents\\rust_artefacts\\packages\\tealdeer\\target\\x86_64-pc-windows-msvc\\debug\\tldr.exe" "--list" code=1 stdout="" stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the cache_dir option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" ', /rustc/90c541806f23a127002de5b4038be731ba1458ca\library\core\src\ops\function.rs:250:5 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

---- test_create_cache_directory_path stdout ---- thread 'test_create_cache_directory_path' panicked at 'Unexpected failure. code-1 stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the `cache_dir` option in the config file instead.\nSuccessfully created cache directory path `C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\.tldr.test.cache6wDibP\\internal`.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" command="C:\\Users\\Administrator\\Documents\\rust_artefacts\\packages\\tealdeer\\target\\x86_64-pc-windows-msvc\\debug\\tldr.exe" "-u" code=1 stdout="" stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the cache_dir option in the config file instead.\nSuccessfully created cache directory path C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\.tldr.test.cache6wDibP\\internal.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" ', /rustc/90c541806f23a127002de5b4038be731ba1458ca\library\core\src\ops\function.rs:250:5

---- test_pager_flag_enable stdout ---- thread 'test_pager_flag_enable' panicked at 'Unexpected failure. code-1 stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the `cache_dir` option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" command="C:\\Users\\Administrator\\Documents\\rust_artefacts\\packages\\tealdeer\\target\\x86_64-pc-windows-msvc\\debug\\tldr.exe" "--update" code=1 stdout="" stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the cache_dir option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" ', /rustc/90c541806f23a127002de5b4038be731ba1458ca\library\core\src\ops\function.rs:250:5

---- test_pager_warning stdout ---- thread 'test_pager_warning' panicked at 'Unexpected failure. code-1 stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the `cache_dir` option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" command="C:\\Users\\Administrator\\Documents\\rust_artefacts\\packages\\tealdeer\\target\\x86_64-pc-windows-msvc\\debug\\tldr.exe" "--update" code=1 stdout="" stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the cache_dir option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" ', /rustc/90c541806f23a127002de5b4038be731ba1458ca\library\core\src\ops\function.rs:250:5

---- test_quiet_cache stdout ---- thread 'test_quiet_cache' panicked at 'Unexpected failure. code-1 stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the `cache_dir` option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" command="C:\\Users\\Administrator\\Documents\\rust_artefacts\\packages\\tealdeer\\target\\x86_64-pc-windows-msvc\\debug\\tldr.exe" "--update" "--quiet" code=1 stdout="" stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the cache_dir option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" ', /rustc/90c541806f23a127002de5b4038be731ba1458ca\library\core\src\ops\function.rs:250:5

---- test_quiet_failures stdout ---- thread 'test_quiet_failures' panicked at 'Unexpected failure. code-1 stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the `cache_dir` option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" command="C:\\Users\\Administrator\\Documents\\rust_artefacts\\packages\\tealdeer\\target\\x86_64-pc-windows-msvc\\debug\\tldr.exe" "--update" "-q" code=1 stdout="" stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the cache_dir option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" ', /rustc/90c541806f23a127002de5b4038be731ba1458ca\library\core\src\ops\function.rs:250:5

---- test_quiet_old_cache stdout ---- thread 'test_quiet_old_cache' panicked at 'Unexpected failure. code-1 stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the `cache_dir` option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" command="C:\\Users\\Administrator\\Documents\\rust_artefacts\\packages\\tealdeer\\target\\x86_64-pc-windows-msvc\\debug\\tldr.exe" "--update" "-q" code=1 stdout="" stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the cache_dir option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" ', /rustc/90c541806f23a127002de5b4038be731ba1458ca\library\core\src\ops\function.rs:250:5

---- test_spaces_find_command stdout ---- thread 'test_spaces_find_command' panicked at 'Unexpected failure. code-1 stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the `cache_dir` option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" command="C:\\Users\\Administrator\\Documents\\rust_artefacts\\packages\\tealdeer\\target\\x86_64-pc-windows-msvc\\debug\\tldr.exe" "--update" code=1 stdout="" stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the cache_dir option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" ', /rustc/90c541806f23a127002de5b4038be731ba1458ca\library\core\src\ops\function.rs:250:5

---- test_update_cache stdout ---- thread 'test_update_cache' panicked at 'Unexpected failure. code-1 stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the `cache_dir` option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" command="C:\\Users\\Administrator\\Documents\\rust_artefacts\\packages\\tealdeer\\target\\x86_64-pc-windows-msvc\\debug\\tldr.exe" "--update" code=1 stdout="" stderr="Warning: The $TEALDEER_CACHE_DIR env variable is deprecated, use the cache_dir option in the config file instead.\nCould not update cache\n\nCaused by:\n 0: error sending request for url (https://tldr.sh/assets/tldr.zip): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 1: error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n 2: invalid peer certificate contents: invalid peer certificate: UnknownIssuer\n" ', /rustc/90c541806f23a127002de5b4038be731ba1458ca\library\core\src\ops\function.rs:250:5

failures: test_autoupdate_cache test_create_cache_directory_path test_pager_flag_enable test_pager_warning test_quiet_cache test_quiet_failures test_quiet_old_cache test_spaces_find_command test_update_cache

test result: FAILED. 19 passed; 9 failed; 0 ignored; 0 measured; 0 filtered out; finished in 6.53s '''

tealdeer version - tealdeer 1.6.1 OS version - Windows version 10.0.20348 Build 20348

niklasmohrin commented 1 year ago

Hm, that is odd, because our CI still works on the windows that github actions has (see https://github.com/dbrgn/tealdeer/actions/runs/5184299853/jobs/9355268707 for a run I started after you opened your issue). What is your Rust toolchain setup? Can you paste the output of rustup show? What is your network setup, does this happen in your home network or in a larger, managed network like workplace or university? Do the tests still fail if you compile with either of the native-roots, webpki-roots and native-tls features enabled (run using, for example, cargo test --no-default-features -F native-tls)?

vidhyasasi commented 1 year ago
  1. Can you paste the output of rustup show? rustup show Default host: x86_64-pc-windows-msvc rustup home: C:\Users\Administrator.rustup

installed toolchains

stable-x86_64-pc-windows-msvc (default) 1.69-x86_64-pc-windows-msvc 1.63.0-x86_64-pc-windows-msvc

active toolchain

stable-x86_64-pc-windows-msvc (default) rustc 1.70.0 (90c541806 2023-05-31)

  1. What is your network setup, does this happen in your home network or in a larger, managed network like workplace or university?

It is a AWS EC Instance

  1. Do the tests still fail if you compile with either of the native-roots, webpki-roots and native-tls features enabled?

I tested with all the features and test passed.

After all these test I tested cargo test again and somehow it worked !

niklasmohrin commented 1 year ago

Okay, thats good to hear :)