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

Integration test fails during package build due to stdout mismatch on compiled binary path #39

Closed
ilmanzo opened this issue May 25, 2024 · 0 comments · Fixed by #40
Closed
Labels
bug Something isn't working

Comments

@ilmanzo
Copy link
Contributor

ilmanzo commented May 25, 2024

Describe the bug
some integration tests for release 1.0.0 fails due to exact match required. When building killport as a package, the build system runs test with binaries in a $TMP location, which is random.

As a workaround, tests could match the output vs a regular expression or check the exit value for success/failure.

To Reproduce
Steps to reproduce the behavior:

  1. Run the command 'cargo test'
  2. See the error
running 5 tests
test test_basic_kill_no_process ... ok
Listening on port 8080
Listening on port 8082
test test_signal_handling ... FAILED
test test_dry_run_option ... FAILED
test test_basic_kill_process ... FAILED
test test_mode_option ... FAILED

failures:

---- test_signal_handling stdout ----
thread 'test_signal_handling' panicked at /home/abuild/rpmbuild/BUILD/rustc-1.78.0-src/library/core/src/ops/function.rs:250:5:
Unexpected stdout, failed diff original var
├── original: Successfully killed process 'mock_process' listening on port 8081
├── diff: 
│   --- 	orig
│   +++ 	var
│   @@ -1 +1 @@
│   -Successfully killed process 'mock_process' listening on port 8081
│   +Successfully killed process '/tmp/.tmpqVZBXU/mock_process' listening on port 8081
└── var as str: Successfully killed process '/tmp/.tmpqVZBXU/mock_process' listening on port 8081

command=`"/home/abuild/rpmbuild/BUILD/killport-1.0.0/target/debug/killport" "8081" "-s" "sighup"`
code=0
stdout="Successfully killed process \'/tmp/.tmpqVZBXU/mock_process\' listening on port 8081\n"
stderr=""


---- test_dry_run_option stdout ----
thread 'test_dry_run_option' panicked at /home/abuild/rpmbuild/BUILD/rustc-1.78.0-src/library/core/src/ops/function.rs:250:5:
Unexpected stdout, failed diff original var
├── original: Would kill process 'mock_process' listening on port 8083
├── diff: 
│   --- 	orig
│   +++ 	var
│   @@ -1 +1 @@
│   -Would kill process 'mock_process' listening on port 8083
│   +Would kill process '/tmp/.tmpa7B36F/mock_process' listening on port 8083
└── var as str: Would kill process '/tmp/.tmpa7B36F/mock_process' listening on port 8083

command=`"/home/abuild/rpmbuild/BUILD/killport-1.0.0/target/debug/killport" "8083" "--dry-run"`
code=0
stdout="Would kill process \'/tmp/.tmpa7B36F/mock_process\' listening on port 8083\n"
stderr=""


---- test_basic_kill_process stdout ----
thread 'test_basic_kill_process' panicked at /home/abuild/rpmbuild/BUILD/rustc-1.78.0-src/library/core/src/ops/function.rs:250:5:
Unexpected stdout, failed diff original var
├── original: Successfully killed process 'mock_process' listening on port 8080
├── diff: 
│   --- 	orig
│   +++ 	var
│   @@ -1 +1 @@
│   -Successfully killed process 'mock_process' listening on port 8080
│   +Successfully killed process '/tmp/.tmpiDoOhp/mock_process' listening on port 8080
└── var as str: Successfully killed process '/tmp/.tmpiDoOhp/mock_process' listening on port 8080

command=`"/home/abuild/rpmbuild/BUILD/killport-1.0.0/target/debug/killport" "8080"`
code=0
stdout="Successfully killed process \'/tmp/.tmpiDoOhp/mock_process\' listening on port 8080\n"
stderr=""

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- test_mode_option stdout ----
thread 'test_mode_option' panicked at /home/abuild/rpmbuild/BUILD/rustc-1.78.0-src/library/core/src/ops/function.rs:250:5:
Unexpected stdout, failed diff original var
├── original: Successfully killed process 'mock_process' listening on port 8082
├── diff: 
│   --- 	orig
│   +++ 	var
│   @@ -1 +1 @@
│   -Successfully killed process 'mock_process' listening on port 8082
│   +Successfully killed process '/tmp/.tmpUuW3bW/mock_process' listening on port 8082
└── var as str: Successfully killed process '/tmp/.tmpUuW3bW/mock_process' listening on port 8082

command=`"/home/abuild/rpmbuild/BUILD/killport-1.0.0/target/debug/killport" "8082" "--mode" "auto"`
code=0
stdout="Successfully killed process \'/tmp/.tmpUuW3bW/mock_process\' listening on port 8082\n"
stderr=""

Expected behavior
No error in integration tests.

Environment (please complete the following information):

  • OS: opensuse-tumbleweed
  • Rust version: rustc 1.78.0 (9b00956e5 2024-04-29)
  • killport version: Release v1.0.0

Additional context
The build logs are available at

https://build.opensuse.org/package/live_build_log/home:amanzini:branches:utilities/killport/openSUSE_Factory/x86_64

@ilmanzo ilmanzo added the bug Something isn't working label May 25, 2024
@ilmanzo ilmanzo changed the title Integration tests failing during package build due to stdout mismatch of binary location Integration tests fai during package build due to stdout mismatch of binary location May 26, 2024
@ilmanzo ilmanzo changed the title Integration tests fai during package build due to stdout mismatch of binary location Integration test fails during package build due to stdout mismatch of binary location May 26, 2024
@ilmanzo ilmanzo changed the title Integration test fails during package build due to stdout mismatch of binary location Integration test fails during package build due to stdout mismatch on compiled binary path May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant