Use environment derived provider in test template

This commit is contained in:
Armani Ferrante 2021-01-27 20:07:09 -08:00
parent 989b1ea3bd
commit cef682a232
No known key found for this signature in database
GPG Key ID: D597A80BCF8E12B7
3 changed files with 10 additions and 8 deletions

6
Cargo.lock generated
View File

@ -2909,9 +2909,9 @@ dependencies = [
[[package]]
name = "solana-program"
version = "1.5.5"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb200f05cb93b01f6e9b2e0d94d240e7e5dfa0b14c4308713b236c01a525a0ef"
checksum = "7a7df63d84d4ba7f67365d179b9994f2690554f313e219f29810b4583077e066"
dependencies = [
"bincode",
"bs58",
@ -2929,7 +2929,7 @@ dependencies = [
"serde",
"serde_bytes",
"serde_derive",
"sha2 0.9.2",
"sha2 0.8.2",
"solana-frozen-abi",
"solana-frozen-abi-macro",
"solana-logger",

View File

@ -1,6 +1,6 @@
use crate::config::{find_cargo_toml, read_all_programs, Config, Program};
use anchor_syn::idl::Idl;
use anyhow::{anyhow, Result};
use anyhow::Result;
use clap::Clap;
use serde::{Deserialize, Serialize};
use solana_client::rpc_client::RpcClient;
@ -394,12 +394,12 @@ fn deploy(url: Option<String>, keypair: Option<String>) -> Result<()> {
println!("Deployed {} at {}", idl.name, address.to_string());
}
run_hosted_deploy(&url, &keypair)?;
run_hosted_deploy(&url)?;
Ok(())
}
fn run_hosted_deploy(url: &str, keypair: &str) -> Result<()> {
fn run_hosted_deploy(url: &str) -> Result<()> {
println!("Running deploy script");
let cur_dir = std::env::current_dir()?;
@ -408,7 +408,7 @@ fn run_hosted_deploy(url: &str, keypair: &str) -> Result<()> {
std::env::set_current_dir(".anchor")?;
std::fs::write("deploy.js", deploy_script_host_str)?;
if let Err(e) = std::process::Command::new("node")
if let Err(_e) = std::process::Command::new("node")
.arg("deploy.js")
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
@ -416,6 +416,8 @@ fn run_hosted_deploy(url: &str, keypair: &str) -> Result<()> {
{
std::process::exit(1);
}
println!("Deploy complete.");
Ok(())
}

View File

@ -112,7 +112,7 @@ pub fn mocha(name: &str) -> String {
describe('{}', () => {{
// Configure the client to use the local cluster.
anchor.setProvider(anchor.Provider.local());
anchor.setProvider(anchor.Provider.env());
it('Is initialized!', async () => {{
// Add your test here.