-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Tests modification for windows CI #9671
Conversation
It looks like @cheme signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
ethstore/src/accounts_dir/vault.rs
Outdated
@@ -310,8 +310,10 @@ mod test { | |||
|
|||
#[test] | |||
fn make_vault_dir_path_succeeds() { | |||
assert_eq!(make_vault_dir_path("/home/user/parity", "vault", true).unwrap().to_str().unwrap(), "/home/user/parity/vault"); | |||
assert_eq!(make_vault_dir_path("/home/user/parity", "*bad-name*", false).unwrap().to_str().unwrap(), "/home/user/parity/*bad-name*"); | |||
use std::path::Path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces here
@@ -186,7 +186,7 @@ mod tests { | |||
|
|||
{ | |||
let corpus_time = &mut cache.corpus.as_mut().unwrap().1; | |||
*corpus_time = *corpus_time - Duration::from_secs(6 * 3600); | |||
*corpus_time = *corpus_time - Duration::from_secs(5 * 3600); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this change needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It substracts overflow otherwhise (of course that is only happening on windows). That looks like a windows bug/inconsistency with duration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️ please describe it in the comment
// on windows the guards deletion (remove_dir_all) | ||
// is not happening (error directory is not empty). | ||
// So the test is disabled until windows api behave. | ||
#[cfg(not(target_os = "windows"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you tell something more about the error returned? Why is it not happening? According to the documentation
Removes a directory at this path, after removing all its contents. Use carefully!
It should happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error is a simple 'directory is not empty', looking at rust-lang/rust#29497 which exists since 2015, I may have been a bit optimistic in saying that there will be a fix someday, we may probably want to use https://crates.io/crates/remove_dir_all .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I ran a test with the 'remove_dir_all' crate, and it is not better : we obtain an "os 32" error "the process cannot access this file because it is used by another process". Solving it will be probably a bit harder than expected, it should probably have its own issue and PR.
let _ = view!(HeaderView, &[]).parent_hash(); | ||
} | ||
#[test] | ||
#[should_panic] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you remove the panic message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The windows panic message contains '' instead of '/' in the file path of the error message. Another option could be to have a copy of this tests for windows.
@@ -105,6 +105,7 @@ mod testing { | |||
http_client::assert_security_headers_present(&response.headers, None); | |||
} | |||
|
|||
#[cfg(not(target_os = "windows"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this test ignored? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not identify the root of the issue, the test is failing on a connection timeout.
use std::path::Path; | ||
|
||
assert_eq!(&make_vault_dir_path("/home/user/parity", "vault", true).unwrap(), &Path::new("/home/user/parity/vault")); | ||
assert_eq!(&make_vault_dir_path("/home/user/parity", "*bad-name*", false).unwrap(), &Path::new("/home/user/parity/*bad-name*")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
let std = parse(&["parity"]); | ||
let base = parse(&["parity", "--base-path", "/test"]); | ||
|
||
let base_path = ::dir::default_data_path(); | ||
let local_path = ::dir::default_local_path(); | ||
assert_eq!(std.directories().cache, dir::helpers::replace_home_and_local(&base_path, &local_path, ::dir::CACHE_PATH)); | ||
assert_eq!(base.directories().cache, "/test/cache"); | ||
assert_eq!(path::Path::new(&base.directories().cache), path::Path::new("/test/cache")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
what's the status of this? |
I think there is valid fixes for windows test that should be merged, there is also two skipped tests, so before merging a issue should be created (one is about directory deletion failing on windows and is not that trivial, the other one is not identified). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of merging this PR, but note, that:
- I don't have a Windows machine atm to test this (but will by the end of this week, not sure if VM is representative enough).
- Not sure whether it's worth the effort if we merge ci: remove failing tests for android, windows, and macos #9788.
- It doesn't fix tests on our Windows CI, but seems like a reasonable step towards making it happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @ordian. Changes LGTM but I was waiting to run it on my Windows machine, but that is back in London.
Merging, it's Windows ;) |
Running tests on windows, fixing some path to string conversion and others windows specifics :
corpus_inaccessible
because of substract overflow happening on windowstest_command_signer_new_token
guards_delete_folder
due to error on removal when guards is droppedshould_allow_if_authorization_is_correct
(timeout error is thrown)At the time those changes allows the test to run on windows 10 vm, but on the windows CI there is still a segfault on specific tests (probably rocksdb related or related to temp path issue) :