From fba158d4d1f108f66633c88bd58a32a40effd804 Mon Sep 17 00:00:00 2001 From: turtlebasket Date: Thu, 22 Sep 2022 23:59:03 +0000 Subject: [PATCH] CLI tests, updates, fixes (reflect hw options) --- tests/test_auction_flow.sh | 3 +++ tests/test_auction_flow_verified.sh | 2 +- x/colinearcore/client/cli/tx_new_auction.go | 3 +-- x/colinearcore/keeper/msg_server_new_auction.go | 10 +++++++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/test_auction_flow.sh b/tests/test_auction_flow.sh index 25445cf..42afcf1 100755 --- a/tests/test_auction_flow.sh +++ b/tests/test_auction_flow.sh @@ -10,16 +10,19 @@ colineard tx colinearcore unlock-all-funds -y --from alice \ | swallow "Unlock all funds before proceeding" colineard tx colinearcore new-auction asdf asdf 2000 uusdc $(now + 3500) \ + '[]' '["gtx-1050-ti"]' 4 0 1000 50 \ -y --from bob \ | expect_fail "Can't create auction below min lease period" colineard tx colinearcore new-auction asdf asdf 2000 uusdc $(now + 8200000) \ + '[]' '["gtx-1050-ti"]' 4 0 1000 50 \ -y --from bob \ | expect_fail "Can't create auction above max lease period" before=$(get_balance $BOB uusdc) colineard tx colinearcore new-auction asdf asdf 2000 uusdc $(now + 3700) \ + '[]' '["gtx-1050-ti"]' 4 0 1000 50 \ -y --from bob \ | expect_success "New auction is created" diff --git a/tests/test_auction_flow_verified.sh b/tests/test_auction_flow_verified.sh index 575435e..33c0cba 100755 --- a/tests/test_auction_flow_verified.sh +++ b/tests/test_auction_flow_verified.sh @@ -17,7 +17,7 @@ colineard tx colinearcore lock-funds 550000000 -y --from bob \ | expect_success "Re-lock funds (Bob)" colineard tx colinearcore new-auction asdf asdf 200 uusdc $(now + 3700) \ - $ALICE \ + '["'$ALICE'"]' '["gtx-1050-ti"]' 4 0 1000 50 \ -y --from bob \ | expect_success "New auction is created" diff --git a/x/colinearcore/client/cli/tx_new_auction.go b/x/colinearcore/client/cli/tx_new_auction.go index 9d77e76..1b3585e 100644 --- a/x/colinearcore/client/cli/tx_new_auction.go +++ b/x/colinearcore/client/cli/tx_new_auction.go @@ -18,7 +18,7 @@ func CmdNewAuction() *cobra.Command { cmd := &cobra.Command{ Use: "new-auction [name] [description] [ceiling] [denom] [end date] [verified providers (json string)] [gpus (json string)] [cpu cores] [cpu arch] [memory (MB)] [storage (GB)]", Short: "Broadcast message newAuction", - Args: cobra.ExactArgs(10), + Args: cobra.ExactArgs(11), // below: we're hardcoding the max providers param since we // can't check chain params locally // Args: cobra.RangeArgs(10, 1010), @@ -69,7 +69,6 @@ func CmdNewAuction() *cobra.Command { if err != nil { return err } - nMemMb, err := strconv.Atoi(memMb) if err != nil { return err diff --git a/x/colinearcore/keeper/msg_server_new_auction.go b/x/colinearcore/keeper/msg_server_new_auction.go index 6db6b2a..974fcd6 100644 --- a/x/colinearcore/keeper/msg_server_new_auction.go +++ b/x/colinearcore/keeper/msg_server_new_auction.go @@ -88,7 +88,11 @@ found: LeaseEnd: msg.LeaseEnd, // remaining payout -> null // Remaining: "0", - Gpus: msg.Gpus, + Gpus: msg.Gpus, + CpuArch: msg.CpuArch, + CpuCores: msg.CpuCores, + MemMb: msg.MemMb, + StorageGb: msg.StorageGb, } // validate hardware @@ -156,8 +160,8 @@ func (k *Keeper) ValidateAuctionHardware(ctx sdk.Context, a types.Auction) error // move these to module params later - if a.CpuCores == 0 || a.CpuCores > 12 { - return errors.New("CPU Cores must be between 0 and 12") + if a.CpuCores < 1 || a.CpuCores > 12 { + return fmt.Errorf("CPU Cores must be between 1 and 12 (got %d)", a.CpuCores) } if a.StorageGb < 25 || a.StorageGb > 2000 {