Skip to content
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ build-e2e: check-go-version crypto/libs/$(OS_TYPE)/$(ARCH)/lib/libsodium.a
@mkdir -p $(GOBIN)-race
# Build regular binaries (kmd, algod, goal) and race binaries in parallel
$(GO_INSTALL) -trimpath $(GOTAGS) $(GOBUILDMODE) -ldflags="$(GOLDFLAGS)" ./cmd/kmd ./cmd/algod ./cmd/goal & \
GOBIN=$(GOBIN)-race go install -trimpath $(GOTAGS) -race -ldflags="$(GOLDFLAGS)" ./cmd/goal ./cmd/algod ./cmd/algoh ./cmd/tealdbg ./cmd/msgpacktool ./cmd/algokey ./tools/teal/algotmpl ./test/e2e-go/cli/tealdbg/cdtmock & \
GOBIN=$(GOBIN)-race go install -trimpath $(GOTAGS) -race -ldflags="$(GOLDFLAGS)" ./cmd/goal ./cmd/algod ./cmd/algoh ./cmd/tealdbg ./cmd/msgpacktool ./cmd/algokey ./cmd/pingpong ./tools/teal/algotmpl ./test/e2e-go/cli/tealdbg/cdtmock & \
wait
cp $(GOBIN)/kmd $(GOBIN)-race

Expand Down
5 changes: 3 additions & 2 deletions shared/pingpong/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ func (pps *WorkerState) makeNewAssets(client *libgoal.Client) (err error) {
return
}
assetsNeeded := int(pps.cfg.NumAsset) - len(pps.cinfo.AssetParams)
assetsToCreate := assetsNeeded // Save original count for later use
newAssetAddrs := make(map[string]*pingPongAccount, assetsNeeded)
for addr, acct := range pps.accounts {
if assetsNeeded <= 0 {
Expand Down Expand Up @@ -418,9 +419,9 @@ func (pps *WorkerState) makeNewAssets(client *libgoal.Client) (err error) {
newAssetAddrs[addr] = acct
}
// wait for new assets to be created, fetch account data for them
newAssets := make(map[basics.AssetIndex]model.AssetParams, assetsNeeded)
newAssets := make(map[basics.AssetIndex]model.AssetParams, assetsToCreate)
timeout := time.Now().Add(10 * time.Second)
for len(newAssets) < assetsNeeded {
for len(newAssets) < assetsToCreate {
for addr, acct := range newAssetAddrs {
ai, err := client.AccountInformation(addr, true)
if err != nil {
Expand Down
34 changes: 31 additions & 3 deletions test/e2e-go/cli/goal/expect/goalExpectCommon.exp
Original file line number Diff line number Diff line change
Expand Up @@ -1408,20 +1408,48 @@ proc ::AlgorandGoal::InspectTransactionFile { TRX_FILE } {
proc ::AlgorandGoal::RunPingpong {DURATION PINGPONG_OPTIONS TEST_PRIMARY_NODE_DIR} {
set timeout [expr $DURATION + 60]
if { [ catch {
set pingpong_base "pingpong run --duration $DURATION -d $TEST_PRIMARY_NODE_DIR --quiet "
set pingpong_base "pingpong run --duration $DURATION -d $TEST_PRIMARY_NODE_DIR "
set pingpong_command [concat $pingpong_base $PINGPONG_OPTIONS]
puts "starting pingpong test with command: $pingpong_command"

# Track whether we're expecting app calls
set expecting_apps 0
if {[string match "*--numapp*" $PINGPONG_OPTIONS]} {
set expecting_apps 1
set saw_app_calls 0
puts "Test expects app calls since --numapp is specified"
}

eval spawn $pingpong_command
expect {
timeout { puts "pingpong test interrupted by timeout, terminating after $timeout seconds" }
timeout { ::AlgorandGoal::Abort "pingpong test interrupted by timeout after $timeout seconds" }
"no acct" {::AlgorandGoal::Abort "pingpong failed with 'no acct' error - likely sender not set in constructAppTxn"}
-re {(?i)error[ :]} {
::AlgorandGoal::Abort "pingpong encountered error: $expect_out(0,string)"
}
-re {(?i)panic} {
::AlgorandGoal::Abort "pingpong panicked: $expect_out(0,string)"
}
"Calling app" {
if {$expecting_apps} {
set saw_app_calls 1
puts "Saw app call"
}
exp_continue
}
-re {Sent (\d+) transactions \((\d+) attempted\).} {
set actual $expect_out(1,string) ;
set attempted $expect_out(2,string) ;
puts "actual: $actual, attempted: $attempted";
if { $actual != $attempted } then { ::AlgorandGoal::Abort "Pingpong attempted to send $attempted transactions, but actual was $actual"; break;}
exp_continue
}
"Terminating after max run time of" {puts "end of ping pong test"}
"Terminating after max run time of" {
puts "end of ping pong test"
if {$expecting_apps && !$saw_app_calls} {
::AlgorandGoal::Abort "Test with --numapp expected app calls but saw none - possible constructAppTxn bug"
}
}
eof {::AlgorandGoal::Abort "pingpong terminated unexpectedly: $expect_out(buffer)"}
"Error" {::AlgorandGoal::Abort "error running pingpong: $expect_out(buffer)"}
}
Expand Down
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongAssetLargeTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "AssetLarge" "asset_transfer_large" "--tps 200 --numasset=10 --numaccounts 5 --refresh 10"
Comment thread
gmalouf marked this conversation as resolved.
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongAssetSmallTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "AssetSmall" "asset_transfer_small" "--tps 200 --numasset=5 --numaccounts 5 --refresh 10"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongAtomicLargeTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "AtomicLarge" "atomic_transfer_large" "--groupsize=12 --tps 200 --refresh 10 --numaccounts 50"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongAtomicSmallTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "AtomicSmall" "atomic_transfer_small" "--groupsize=5 --tps 200 --refresh 10 --numaccounts 50"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongBigOpsBigHashTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "BigOpsBigHash" "bigops_bighash" "--appprogops 220 --appproghashes 10 --appproghashsize sha512_256 --numapp 10 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongBigOpsMediumHashTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "BigOpsMediumHash" "bigops_mediumhash" "--appprogops 300 --appproghashes 5 --appproghashsize sha512_256 --numapp 10 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongBigOpsSmallHashTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "BigOpsSmallHash" "bigops_smallhash" "--appprogops 500 --appproghashes 2 --appproghashsize sha512_256 --numapp 10 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000"
98 changes: 98 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongCommon.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/usr/bin/expect -f
# Common utilities for pingpong tests
# This file should be sourced by individual pingpong test files

source goalExpectCommon.exp

# Setup a pingpong test network and return network info
proc setupPingpongNetwork { TEST_ALGO_DIR TEST_DATA_DIR } {
set timeout 60
set TIME_STAMP [clock seconds]

set TEST_ROOT_DIR $TEST_ALGO_DIR/root_$TIME_STAMP
set TEST_PRIMARY_NODE_DIR $TEST_ROOT_DIR/Primary/
set NETWORK_NAME test_net_expect_$TIME_STAMP
set NETWORK_TEMPLATE "$TEST_DATA_DIR/nettemplates/TwoNodes50EachFuture.json"

# Copy genesis file
exec cp $TEST_DATA_DIR/../../installer/genesis/devnet/genesis.json $TEST_ALGO_DIR

# Create and start network
::AlgorandGoal::CreateNetwork $NETWORK_NAME $NETWORK_TEMPLATE $TEST_ALGO_DIR $TEST_ROOT_DIR
::AlgorandGoal::StartNetwork $NETWORK_NAME $NETWORK_TEMPLATE $TEST_ROOT_DIR

# Get network info
set PRIMARY_NODE_ADDRESS [ ::AlgorandGoal::GetAlgodNetworkAddress $TEST_PRIMARY_NODE_DIR ]
puts "Primary Node Address: $PRIMARY_NODE_ADDRESS"

set PRIMARY_WALLET_NAME unencrypted-default-wallet

# Determine primary account
set PRIMARY_ACCOUNT_ADDRESS [::AlgorandGoal::GetHighestFundedAccountForWallet $PRIMARY_WALLET_NAME $TEST_PRIMARY_NODE_DIR]

# Check the balance of the primary account
set PRIMARY_ACCOUNT_BALANCE [::AlgorandGoal::GetAccountBalance $PRIMARY_WALLET_NAME $PRIMARY_ACCOUNT_ADDRESS $TEST_PRIMARY_NODE_DIR]
puts "Primary Account Balance: $PRIMARY_ACCOUNT_BALANCE"

# Wait for round 1 to ensure network is ready
::AlgorandGoal::WaitForRound 1 $TEST_PRIMARY_NODE_DIR

# Return list of important values
return [list $TEST_ROOT_DIR $TEST_PRIMARY_NODE_DIR $NETWORK_NAME $PRIMARY_NODE_ADDRESS $PRIMARY_ACCOUNT_ADDRESS]
}

# Teardown a pingpong test network
proc teardownPingpongNetwork { NETWORK_NAME TEST_ROOT_DIR } {
::AlgorandGoal::StopNetwork $NETWORK_NAME $TEST_ROOT_DIR
}

# Run a pingpong variation with the given arguments
proc runPingpongVariation { variation_name pingpong_args TEST_PRIMARY_NODE_DIR duration } {
puts "Running pingpong variation: $variation_name"
puts "Arguments: $pingpong_args"
puts "Duration: $duration seconds"

::AlgorandGoal::RunPingpong $duration $pingpong_args $TEST_PRIMARY_NODE_DIR
}

# Common error handler for pingpong tests
proc pingpongTestErrorHandler { test_name exception } {
::AlgorandGoal::Abort "ERROR in $test_name: $exception"
}

# Main test runner that does all the work
proc runPingpongTest { test_name variation_name pingpong_args {duration 5} } {
global TEST_ALGO_DIR TEST_DATA_DIR

# Setup network
set network_info [setupPingpongNetwork $TEST_ALGO_DIR $TEST_DATA_DIR]
set TEST_ROOT_DIR [lindex $network_info 0]
set TEST_PRIMARY_NODE_DIR [lindex $network_info 1]
set NETWORK_NAME [lindex $network_info 2]

# Run the test
runPingpongVariation $variation_name $pingpong_args $TEST_PRIMARY_NODE_DIR $duration

# Teardown network
teardownPingpongNetwork $NETWORK_NAME $TEST_ROOT_DIR

puts "Pingpong $test_name Test Successful"
}

# Main entry point for all pingpong tests
proc pingpongTestMain { test_name variation_name pingpong_args {duration 5} } {
global TEST_ALGO_DIR TEST_DATA_DIR

if { [catch {
source goalExpectCommon.exp
puts "Starting $test_name"
puts "TEST_ALGO_DIR: $TEST_ALGO_DIR"
puts "TEST_DATA_DIR: $TEST_DATA_DIR"

runPingpongTest $test_name $variation_name $pingpong_args $duration

exit 0
} EXCEPTION ] } {
pingpongTestErrorHandler $test_name $EXCEPTION
}
}
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongMediumOpsBigHashTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "MediumOpsBigHash" "mediumops_bighash" "--appprogops 200 --appproghashes 10 --appproghashsize sha512_256 --numapp 10 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "MediumOpsMediumHash" "mediumops_mediumhash" "--appprogops 200 --appproghashes 5 --appproghashsize sha512_256 --numapp 10 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "MediumOpsSmallHash" "mediumops_smallhash" "--appprogops 200 --appproghashes 2 --appproghashsize sha512_256 --numapp 10 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongPaymentTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "Payment" "payment_transaction" "--tps 200 --refresh 10 --numaccounts 50"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongRekeyTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "Rekey" "rekey_payment_transaction" "--rekey=true --groupsize=2 --randomnote=true --tps 200 --refresh 10 --numaccounts 50"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongSmallOpsBigHashTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "SmallOpsBigHash" "smallops_bighash" "--appprogops 2 --appproghashes 10 --appproghashsize sha512_256 --numapp 10 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "SmallOpsMediumHash" "smallops_mediumhash" "--appprogops 2 --appproghashes 5 --appproghashsize sha512_256 --numapp 10 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongSmallOpsSmallHashTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "SmallOpsSmallHash" "smallops_smallhash" "--appprogops 2 --appproghashes 2 --appproghashsize sha512_256 --numapp 10 --tps 200 --refresh 10 --numaccounts 5 --minaccount 100000000"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongStatefulBoxReadTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "StatefulBoxRead" "stateful_box_read" "--numapp 10 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000 --numboxread 5"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongStatefulBoxUpdateTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "StatefulBoxUpdate" "stateful_box_update" "--numapp 10 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000 --numboxupdate 5"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongStatefulLargeTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "StatefulLarge" "stateful_teal_large" "--numapp 10 --appprogops 695 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongStatefulMediumTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "StatefulMedium" "stateful_teal_medium" "--numapp 10 --appprogops 200 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongStatefulSmallTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "StatefulSmall" "stateful_teal_small" "--numapp 10 --appprogops 10 --tps 200 --refresh 10 --numaccounts 50 --minaccount 100000000"
Comment thread
gmalouf marked this conversation as resolved.
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongTealHeavyTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "TealHeavy" "teal_heavy_transaction" "--teal=heavy --tps 200 --refresh 10 --numaccounts 50"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongTealLightTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "TealLight" "teal_light_transaction" "--teal=light --tps 200 --refresh 10 --numaccounts 50"
5 changes: 5 additions & 0 deletions test/e2e-go/cli/goal/expect/pingpongTealNormalTest.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/expect -f
set TEST_ALGO_DIR [lindex $argv 0]
set TEST_DATA_DIR [lindex $argv 1]
source pingpongCommon.exp
pingpongTestMain "TealNormal" "teal_normal_transaction" "--teal=normal --tps 200 --refresh 10 --numaccounts 50"
Loading
Loading