cli: Allow custom program addresses for test (#554)
This commit is contained in:
parent
a753eb0f0b
commit
03042590a9
|
@ -14,6 +14,7 @@ incremented for features.
|
|||
### Features
|
||||
|
||||
* cli: Add keys `members` / `exclude` in config `programs` section ([#546](https://github.com/project-serum/anchor/pull/546)).
|
||||
* cli: Allow program address configuration for test command through `clusters.localnet` ([#554](https://github.com/project-serum/anchor/pull/554)).
|
||||
* lang: IDLs are now parsed from the entire crate ([#517](https://github.com/project-serum/anchor/pull/517)).
|
||||
|
||||
### Breaking Changes
|
||||
|
|
|
@ -1063,12 +1063,19 @@ fn test(
|
|||
// Returns the solana-test-validator flags to embed the workspace programs
|
||||
// in the genesis block. This allows us to run tests without every deploying.
|
||||
fn genesis_flags(cfg: &Config) -> Result<Vec<String>> {
|
||||
let clusters = cfg.clusters.get(&Cluster::Localnet);
|
||||
|
||||
let mut flags = Vec::new();
|
||||
for mut program in cfg.read_all_programs()? {
|
||||
let binary_path = program.binary_path().display().to_string();
|
||||
|
||||
let address = clusters
|
||||
.and_then(|m| m.get(&program.idl.name))
|
||||
.map(|deployment| deployment.address.to_string())
|
||||
.unwrap_or_else(|| {
|
||||
let kp = Keypair::generate(&mut OsRng);
|
||||
let address = kp.pubkey().to_string();
|
||||
kp.pubkey().to_string()
|
||||
});
|
||||
|
||||
flags.push("--bpf-program".to_string());
|
||||
flags.push(address.clone());
|
||||
|
|
Loading…
Reference in New Issue