Ensure new health endpoint builds on MacOS (#1215)
* Add mac build to CI * Always return an error for Health when not linux * Change macos workflow * Rename macos tests * Disable health API test on Mac Co-authored-by: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
parent
cb26ddebb1
commit
723c7cbd27
13
.github/workflows/test-suite.yml
vendored
13
.github/workflows/test-suite.yml
vendored
@ -26,6 +26,19 @@ jobs:
|
|||||||
run: sudo npm install -g ganache-cli
|
run: sudo npm install -g ganache-cli
|
||||||
- name: Run tests in release
|
- name: Run tests in release
|
||||||
run: make test-release
|
run: make test-release
|
||||||
|
release-tests-and-install-macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
needs: cargo-fmt
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Get latest version of stable Rust
|
||||||
|
run: rustup update stable
|
||||||
|
- name: Install ganache-cli
|
||||||
|
run: sudo npm install -g ganache-cli
|
||||||
|
- name: Run tests in release
|
||||||
|
run: make test-release
|
||||||
|
- name: Install Lighthouse
|
||||||
|
run: make
|
||||||
debug-tests-ubuntu:
|
debug-tests-ubuntu:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: cargo-fmt
|
needs: cargo-fmt
|
||||||
|
@ -105,6 +105,8 @@ pub fn get_prometheus<T: BeaconChainTypes>(
|
|||||||
store::scrape_for_metrics(&db_path, &freezer_db_path);
|
store::scrape_for_metrics(&db_path, &freezer_db_path);
|
||||||
beacon_chain::scrape_for_metrics(&beacon_chain);
|
beacon_chain::scrape_for_metrics(&beacon_chain);
|
||||||
|
|
||||||
|
// This will silently fail if we are unable to observe the health. This is desired behaviour
|
||||||
|
// since we don't support `Health` for all platforms.
|
||||||
if let Ok(health) = Health::observe() {
|
if let Ok(health) = Health::observe() {
|
||||||
set_gauge(&PROCESS_NUM_THREADS, health.pid_num_threads as i64);
|
set_gauge(&PROCESS_NUM_THREADS, health.pid_num_threads as i64);
|
||||||
set_gauge(&PROCESS_RES_MEM, health.pid_mem_resident_set_size as i64);
|
set_gauge(&PROCESS_RES_MEM, health.pid_mem_resident_set_size as i64);
|
||||||
|
@ -1253,6 +1253,7 @@ mod validator_attestation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
#[test]
|
#[test]
|
||||||
fn get_health() {
|
fn get_health() {
|
||||||
let mut env = build_env();
|
let mut env = build_env();
|
||||||
|
@ -14,5 +14,7 @@ state_processing = { path = "../../consensus/state_processing" }
|
|||||||
bls = { path = "../../crypto/bls" }
|
bls = { path = "../../crypto/bls" }
|
||||||
serde = { version = "1.0.110", features = ["derive"] }
|
serde = { version = "1.0.110", features = ["derive"] }
|
||||||
rayon = "1.3.0"
|
rayon = "1.3.0"
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
psutil = "3.1.0"
|
psutil = "3.1.0"
|
||||||
procinfo = "0.4.2"
|
procinfo = "0.4.2"
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
//! Collection of types for the /node HTTP
|
//! Collection of types for the /node HTTP
|
||||||
use procinfo::pid;
|
|
||||||
use psutil::process::Process;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use types::Slot;
|
use types::Slot;
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
use {procinfo::pid, psutil::process::Process};
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Encode, Decode)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Encode, Decode)]
|
||||||
/// The current syncing status of the node.
|
/// The current syncing status of the node.
|
||||||
pub struct SyncingStatus {
|
pub struct SyncingStatus {
|
||||||
@ -63,6 +64,12 @@ pub struct Health {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Health {
|
impl Health {
|
||||||
|
#[cfg(not(target_os = "linux"))]
|
||||||
|
pub fn observe() -> Result<Self, String> {
|
||||||
|
Err("Health is only available on Linux".into())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
pub fn observe() -> Result<Self, String> {
|
pub fn observe() -> Result<Self, String> {
|
||||||
let process =
|
let process =
|
||||||
Process::current().map_err(|e| format!("Unable to get current process: {:?}", e))?;
|
Process::current().map_err(|e| format!("Unable to get current process: {:?}", e))?;
|
||||||
|
Loading…
Reference in New Issue
Block a user