Make test result not depend on TestValidator setup (#21078)

This commit is contained in:
Tyera Eulberg 2021-10-29 16:19:10 -06:00 committed by GitHub
parent bced07a099
commit 32a242e777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 8 deletions

View File

@ -227,15 +227,16 @@ fn test_program_subscription() {
..RpcProgramAccountsConfig::default()
});
let program_id = Pubkey::new_unique();
let (mut client, receiver) = PubsubClient::program_subscribe(
&format!("ws://0.0.0.0:{}/", pubsub_addr.port()),
&system_program::id(),
&program_id,
config,
)
.unwrap();
// Transfer 100 lamports from alice to bob
let tx = system_transaction::transfer(&alice, &bob.pubkey(), 100, blockhash);
// Create new program account at bob's address
let tx = system_transaction::create_account(&alice, &bob, blockhash, 100, 0, &program_id);
bank_forks
.write()
.unwrap()
@ -278,11 +279,7 @@ fn test_program_subscription() {
client.shutdown().unwrap();
pubsub_service.close().unwrap();
// system_transaction::transfer() will generate 7 program account notifications for system_program
// since accounts need to be created
assert_eq!(notifications.len(), 7);
assert!(pubkeys.contains(&alice.pubkey().to_string()));
assert_eq!(notifications.len(), 1);
assert!(pubkeys.contains(&bob.pubkey().to_string()));
}