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

Improved Coffee Verification and CoffeeNurse Functionality #207

Merged
merged 3 commits into from
Oct 12, 2023

Conversation

tareknaser
Copy link
Collaborator

Description

This pull request introduces enhancements to coffee command-line tool:

1. Verification Enhancements:

  • coffee now checks the status of its configuration before executing each command.
  • If the configuration is found to be in an unsatisfactory state, the command will return an error.
  • To bypass this verification step, users can employ the --skip-verify flag.

2. CoffeeNurse Improvements:

  • Implemented is_sane for CoffeeNurse type to assess the sanity of the coffee configuration.
  • Introduced the organize method for CoffeeNurse, ensuring each action is included only once.
  • Added a new method, coffee_verify, which allows users to check coffee configuration's status without taking any action.

3. New --verify Flag:

  • The coffee nurse command now supports a --verify flag, which invokes the coffee_verify method.

4. Testing and Documentation:

  • Included a test case for the coffee_verify method.
  • Updated documentation to reflect these enhancements.

Fixes #128

@netlify
Copy link

netlify bot commented Oct 8, 2023

Deploy Preview for coffee-docs canceled.

Name Link
🔨 Latest commit 5d7730f
🔍 Latest deploy log https://app.netlify.com/sites/coffee-docs/deploys/652842147465e70008da0505

coffee_cmd/src/main.rs Outdated Show resolved Hide resolved
coffee_core/src/config.rs Show resolved Hide resolved
coffee_lib/src/types/mod.rs Outdated Show resolved Hide resolved
coffee_lib/src/types/mod.rs Outdated Show resolved Hide resolved
 This commit introduces the following changes:
- It now checks the status of the coffee configuration before executing each command.
- If the coffee status is found to be not sane, the command will return an error.
- To bypass this verification step, you can use the --skip-verify flag.
- By default, the --skip-verify flag is set to true for the httpd, coffee_plugin, and testing crates.

Signed-off-by: Tarek <[email protected]>
This commit introduces the following changes:
- Implementation of the is_sane method for the CoffeeNurse type.
- Implementation of the organize method for the CoffeeNurse type, which organizes the actions taken by coffee nurse to ensure each action is included only once.
- Addition of a new method called coffee_verify to check the status of the coffee configuration without taking any action.
- Introduction of a --verify flag for the coffee nurse command, which calls the coffee_verify method.
- Inclusion of a test for the coffee_verify method.

Signed-off-by: Tarek <[email protected]>
@vincenzopalazzo
Copy link
Contributor

2023-10-12T19:08:14.8401429Z �[36mcoffee_1  |�[0m ---- coffee_httpd_integration_tests::httpd_init_add_remote stdout ----
2023-10-12T19:08:14.8402659Z �[36mcoffee_1  |�[0m thread '<unnamed>' panicked at tests/src/coffee_httpd_integration_tests.rs:66:10:
2023-10-12T19:08:14.8404338Z �[36mcoffee_1  |�[0m called `Result::unwrap()` on an `Err` value: Rpc(RpcError { code: -32601, message: "Unknown command 'summary'", data: None })
2023-10-12T19:08:14.8405713Z �[36mcoffee_1  |�[0m stack backtrace:
2023-10-12T19:08:14.8406267Z �[36mcoffee_1  |�[0m    0: rust_begin_unwind
2023-10-12T19:08:14.8407588Z �[36mcoffee_1  |�[0m              at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
2023-10-12T19:08:14.8408688Z �[36mcoffee_1  |�[0m    1: core::panicking::panic_fmt
2023-10-12T19:08:14.8409797Z �[36mcoffee_1  |�[0m              at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
2023-10-12T19:08:14.8410869Z �[36mcoffee_1  |�[0m    2: core::result::unwrap_failed
2023-10-12T19:08:14.8411965Z �[36mcoffee_1  |�[0m              at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/result.rs:1652:5
2023-10-12T19:08:14.8413060Z �[36mcoffee_1  |�[0m    3: core::result::Result<T,E>::unwrap
2023-10-12T19:08:14.8414168Z �[36mcoffee_1  |�[0m              at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/result.rs:1077:23
2023-10-12T19:08:14.8415629Z �[36mcoffee_1  |�[0m    4: tests::coffee_httpd_integration_tests::httpd_init_add_remote::ntest_callback::{{closure}}
2023-10-12T19:08:14.8416794Z �[36mcoffee_1  |�[0m              at ./src/coffee_httpd_integration_tests.rs:64:5
2023-10-12T19:08:14.8417800Z �[36mcoffee_1  |�[0m    5: <core::pin::Pin<P> as core::future::future::Future>::poll
2023-10-12T19:08:14.8419081Z �[36mcoffee_1  |�[0m              at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/future/future.rs:125:9
2023-10-12T19:08:14.8420385Z �[36mcoffee_1  |�[0m    6: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
2023-10-12T19:08:14.8421815Z �[36mcoffee_1  |�[0m              at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/park.rs:283:63
2023-10-12T19:08:14.8423035Z �[36mcoffee_1  |�[0m    7: tokio::runtime::coop::with_budget
2023-10-12T19:08:14.8424286Z �[36mcoffee_1  |�[0m              at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/coop.rs:107:5
2023-10-12T19:08:14.8425477Z �[36mcoffee_1  |�[0m    8: tokio::runtime::coop::budget
2023-10-12T19:08:14.8426851Z �[36mcoffee_1  |�[0m              at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/coop.rs:73:5
2023-10-12T19:08:14.8428178Z �[36mcoffee_1  |�[0m    9: tokio::runtime::park::CachedParkThread::block_on
2023-10-12T19:08:14.8429530Z �[36mcoffee_1  |�[0m              at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/park.rs:283:31
2023-10-12T19:08:14.8430963Z �[36mcoffee_1  |�[0m   10: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
2023-10-12T19:08:14.8432475Z �[36mcoffee_1  |�[0m              at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/context/blocking.rs:66:9
2023-10-12T19:08:14.8434049Z �[36mcoffee_1  |�[0m   11: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
2023-10-12T19:08:14.8435741Z �[36mcoffee_1  |�[0m              at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/mod.rs:87:13
2023-10-12T19:08:14.8437206Z �[36mcoffee_1  |�[0m   12: tokio::runtime::context::runtime::enter_runtime
2023-10-12T19:08:14.8438616Z �[36mcoffee_1  |�[0m              at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/context/runtime.rs:65:16
2023-10-12T19:08:14.8440110Z �[36mcoffee_1  |�[0m   13: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
2023-10-12T19:08:14.8441711Z �[36mcoffee_1  |�[0m              at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/mod.rs:86:9
2023-10-12T19:08:14.8443149Z �[36mcoffee_1  |�[0m   14: tokio::runtime::runtime::Runtime::block_on
2023-10-12T19:08:14.8444474Z �[36mcoffee_1  |�[0m              at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/runtime.rs:313:45
2023-10-12T19:08:14.8518051Z �[36mcoffee_1  |�[0m   15: tests::coffee_httpd_integration_tests::httpd_init_add_remote::ntest_callback
2023-10-12T19:08:14.8519205Z �[36mcoffee_1  |�[0m              at ./src/coffee_httpd_integration_tests.rs:68:5
2023-10-12T19:08:14.8520646Z �[36mcoffee_1  |�[0m   16: tests::coffee_httpd_integration_tests::httpd_init_add_remote::{{closure}}
2023-10-12T19:08:14.8521779Z �[36mcoffee_1  |�[0m              at ./src/coffee_httpd_integration_tests.rs:10:1
2023-10-12T19:08:14.8522968Z �[36mcoffee_1  |�[0m note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
2023-10-12T19:08:14.8524953Z �[36mcoffee_1  |�[0m thread 'coffee_httpd_integration_tests::httpd_init_add_remote' panicked at tests/src/coffee_httpd_integration_tests.rs:10:1:
2023-10-12T19:08:14.8526121Z �[36mcoffee_1  |�[0m explicit panic
2023-10-12T19:08:14.8529703Z �[36mcoffee_1  |�[0m stack backtrace:
2023-10-12T19:08:14.8530536Z �[36mcoffee_1  |�[0m    0: std::panicking::begin_panic
2023-10-12T19:08:14.8531666Z �[36mcoffee_1  |�[0m              at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:627:12
2023-10-12T19:08:14.8532974Z �[36mcoffee_1  |�[0m    1: tests::coffee_httpd_integration_tests::httpd_init_add_remote
2023-10-12T19:08:14.8533980Z �[36mcoffee_1  |�[0m              at ./src/coffee_httpd_integration_tests.rs:10:1
2023-10-12T19:08:14.8535092Z �[36mcoffee_1  |�[0m    2: tests::coffee_httpd_integration_tests::httpd_init_add_remote::{{closure}}
2023-10-12T19:08:14.8536173Z �[36mcoffee_1  |�[0m              at ./src/coffee_httpd_integration_tests.rs:11:38
2023-10-12T19:08:14.8537082Z �[36mcoffee_1  |�[0m    3: core::ops::function::FnOnce::call_once
2023-10-12T19:08:14.8538268Z �[36mcoffee_1  |�[0m              at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/ops/function.rs:250:5
2023-10-12T19:08:14.8539415Z �[36mcoffee_1  |�[0m    4: core::ops::function::FnOnce::call_once
2023-10-12T19:08:14.8540589Z �[36mcoffee_1  |�[0m              at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/ops/function.rs:250:5
2023-10-12T19:08:14.8542270Z �[36mcoffee_1  |�[0m note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
2023-10-12T19:08:14.8544121Z �[36mcoffee_1  |�[0m 
2023-10-12T19:08:14.8544513Z �[36mcoffee_1  |�[0m 

Unrelated failure but we should debug it @tareknaser

Copy link
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tareknaser
Copy link
Collaborator Author

Unrelated failure but we should debug it @tareknaser

This is the error we encountered before #201
and this was an effort to make the tests easier to debug https://github.com/coffee-tools/coffee/pulls?q=is%3Apr+is%3Aclosed

Here is the error:
https://github.com/coffee-tools/coffee/actions/runs/6499793279/job/17653875473?pr=207#step:3:4210
seems like a python library cffi is missing but I don't know why it passes sometimes.

@vincenzopalazzo
Copy link
Contributor

Thanks good catch @tareknaser

I open a issue for it

@vincenzopalazzo vincenzopalazzo merged commit 26286a2 into coffee-tools:master Oct 12, 2023
8 of 9 checks passed
@tareknaser tareknaser deleted the nurse2 branch October 12, 2023 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nurse Command Recovery Strategy Cases and Handlers
2 participants