Unverified Commit b9a3ded4 authored by Harry Barber's avatar Harry Barber Committed by GitHub
Browse files

Remove hardcoded crate names from `run_server` functions (#2529)

## Motivation and Context

In the case of a crate rename we don't want these functions to break.

## Description

Replace string literals representing the example crate name with
`std::env::var("CARGO_PKG_NAME").unwrap()`
parent d626fd28
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -18,10 +18,8 @@ use pokemon_service_common::{rewrite_base_url, ChildDrop};
use pokemon_service_tls::{DEFAULT_DOMAIN, DEFAULT_PORT, DEFAULT_TEST_CERT};

pub async fn run_server() -> ChildDrop {
    let child = Command::cargo_bin("pokemon-service-tls")
        .unwrap()
        .spawn()
        .unwrap();
    let crate_name = std::env::var("CARGO_PKG_NAME").unwrap();
    let child = Command::cargo_bin(crate_name).unwrap().spawn().unwrap();

    sleep(Duration::from_millis(500)).await;

+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ use aws_smithy_http_server::{
use clap::Parser;

use plugin::PrintExt;

use pokemon_service::{
    do_nothing_but_log_request_ids, get_storage_with_local_approved, DEFAULT_ADDRESS, DEFAULT_PORT,
};
+2 −4
Original line number Diff line number Diff line
@@ -15,10 +15,8 @@ use pokemon_service_client::{Builder, Client, Config};
use pokemon_service_common::{rewrite_base_url, ChildDrop};

pub async fn run_server() -> ChildDrop {
    let child = Command::cargo_bin("pokemon-service")
        .unwrap()
        .spawn()
        .unwrap();
    let crate_name = std::env::var("CARGO_PKG_NAME").unwrap();
    let child = Command::cargo_bin(crate_name).unwrap().spawn().unwrap();

    sleep(Duration::from_millis(500)).await;