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

Use unstable explorer client #5058

Merged
merged 11 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,064 changes: 338 additions & 726 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions common/models/src/ns_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct TestrunAssignment {
/// has nothing to do with GW identity key. This is PK from `gateways` table
pub testrun_id: i64,
pub gateway_pk_id: i64,
pub gateway_identity_key: String,
}
2 changes: 1 addition & 1 deletion nym-node-status-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[package]
name = "nym-node-status-agent"
version = "0.1.0"
version = "0.1.4"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
Expand Down
14 changes: 10 additions & 4 deletions nym-node-status-agent/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

set -eu

export RUST_LOG=${RUST_LOG:-debug}
environment="qa"

source ../envs/${environment}.env

export RUST_LOG="debug"

crate_root=$(dirname $(realpath "$0"))
gateway_probe_src=$(dirname $(dirname "$crate_root"))/nym-vpn-client/nym-vpn-core
Expand All @@ -14,6 +18,8 @@ export NODE_STATUS_AGENT_PROBE_PATH="$crate_root/nym-gateway-probe"
# build & copy over GW probe
function copy_gw_probe() {
pushd $gateway_probe_src
git switch main
git pull
cargo build --release --package nym-gateway-probe
cp target/release/nym-gateway-probe "$crate_root"
$crate_root/nym-gateway-probe --version
Expand All @@ -30,8 +36,8 @@ function swarm() {

build_agent

for ((i=1; i<=$workers; i++)); do
../target/release/nym-node-status-agent run-probe &
for ((i = 1; i <= $workers; i++)); do
../target/release/nym-node-status-agent run-probe &
done

wait
Expand All @@ -44,6 +50,6 @@ export NODE_STATUS_AGENT_SERVER_PORT="8000"

copy_gw_probe

swarm 30
swarm 8

# cargo run -- run-probe
12 changes: 4 additions & 8 deletions nym-node-status-agent/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,19 @@ pub(crate) enum Command {
/// path of binary to run
#[arg(long, env = "NODE_STATUS_AGENT_PROBE_PATH")]
probe_path: String,
#[arg(short, long, env = "NODE_STATUS_AGENT_GATEWAY_ID")]
gateway_id: Option<String>,
},
}

impl Args {
pub(crate) async fn execute(&self) -> anyhow::Result<()> {
match &self.command {
Command::RunProbe {
probe_path,
gateway_id,
} => self.run_probe(probe_path, gateway_id).await?,
Command::RunProbe { probe_path } => self.run_probe(probe_path).await?,
}

Ok(())
}

async fn run_probe(&self, probe_path: &str, gateway_id: &Option<String>) -> anyhow::Result<()> {
async fn run_probe(&self, probe_path: &str) -> anyhow::Result<()> {
let server_address = format!("{}:{}", &self.server_address, self.server_port);

let probe = GwProbe::new(probe_path.to_string());
Expand All @@ -58,7 +53,7 @@ impl Args {

let testrun = request_testrun(&server_address).await?;

let log = probe.run_and_get_log(gateway_id);
let log = probe.run_and_get_log(&Some(testrun.gateway_identity_key));

submit_results(&server_address, testrun.testrun_id, log).await?;

Expand Down Expand Up @@ -97,6 +92,7 @@ async fn submit_results(
) -> anyhow::Result<()> {
let target_url = format!("{}/{}/{}", server_addr, URL_BASE, testrun_id);
let client = reqwest::Client::new();

let res = client
.post(target_url)
.body(probe_outcome)
Expand Down
6 changes: 6 additions & 0 deletions nym-node-status-agent/src/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ impl GwProbe {
match command.spawn() {
Ok(child) => {
if let Ok(output) = child.wait_with_output() {
if !output.status.success() {
let out = String::from_utf8_lossy(&output.stdout);
let err = String::from_utf8_lossy(&output.stderr);
tracing::error!("Probe exited with {:?}:\n{}\n{}", output.status, out, err);
}

return String::from_utf8(output.stdout)
.unwrap_or("Unable to get log from test run".to_string());
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading