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

fix: Cargo test failure in Windows environment #108

Merged
merged 2 commits into from
Sep 27, 2024
Merged

Conversation

jyc0011
Copy link
Contributor

@jyc0011 jyc0011 commented Aug 2, 2024

When you run cargo test in a Windows environment, a failure occurs. (This is written in Issue #107.) Here is the issue:

thread 'test_dynamic_bootstrap' panicked at harness\src\utils.rs:116:10:
Failed to execute lsof command: Error { kind: NotFound, message: "program not found" }

The reason why this happens is that Windows uses different system commands than Unix-based operating systems.

Therefore, the command to check the port occupancy status and the command to release the port occupancy are different between Windows and Unix.

  • If the command to check the port occupancy status in a Unix environment is losf, then in a Windows environment it is netstat.
  • If the command to release a port occupancy in a Unix environment is kill, then in Windows it is taskkill.

For that reason, I modified the code in that part so that I can check the OS environment and issue instructions with commands appropriate for the OS. With this code change, test test_static_bootstrap now succeeds, but test test_dynamic_bootstrap still fails.

The error that occurs in this regard is:

test test_dynamic_bootstrap ... FAILED
test test_static_bootstrap ... ok

failures:

---- test_dynamic_bootstrap stdout ----
thread 'test_dynamic_bootstrap' panicked at E:\raftify-main\harness\src\raft.rs:156:10:
called `Result::unwrap()` on an `Err` value: Grpc(tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 10061, kind: ConnectionRefused, message: "대상 컴퓨터에서 연결을 거부했으므로 연결하지  못했습니다." }))))
thread 'test_dynamic_bootstrap' panicked at harness\tests\bootstrap.rs:48:6:
called `Result::unwrap()` on an `Err` value: JoinError::Panic(Id(50), ...)


failures:
    test_dynamic_bootstrap

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.58s

error: test failed, to rerun pass `-p harness --test bootstrap`

It looks like this error is occurring because the gRPC connection is refused.

@jyc0011 jyc0011 marked this pull request as draft August 2, 2024 03:43
Copy link

cla-assistant bot commented Aug 2, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ jopemachine
❌ jyc0011
You have signed the CLA already but the status is still pending? Let us recheck it.

@jopemachine jopemachine changed the title fix : Cargo test failure in Windows environment: fix: Cargo test failure in Windows environment Aug 2, 2024
@jopemachine
Copy link
Member

jopemachine commented Sep 27, 2024

The issue you mentioned seems to have occurred while running cargo test.
Currently, since the ports are shared, errors occur when running the tests in parallel.
As with the Makefile, if you run the tests individually, you can see that no errors occur.

@jopemachine jopemachine marked this pull request as ready for review September 27, 2024 01:39
@jopemachine
Copy link
Member

Thanks!

@jopemachine jopemachine merged commit 7ff4d30 into lablup:main Sep 27, 2024
1 of 2 checks passed
@jopemachine jopemachine linked an issue Sep 27, 2024 that may be closed by this pull request
@jopemachine jopemachine removed a link to an issue Sep 30, 2024
@jopemachine jopemachine linked an issue Sep 30, 2024 that may be closed by this pull request
@jopemachine jopemachine added the ossca-24 OSS Contribution Academy mentee's contributions. label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ossca-24 OSS Contribution Academy mentee's contributions. test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cargo test command not working on Windows
2 participants