-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updated: added test cases for storage version #1114
base: sprint-1.18
Are you sure you want to change the base?
Conversation
@@ -21,6 +21,31 @@ func TestCreateAllocation(testSetup *testing.T) { | |||
|
|||
t.Parallel() | |||
|
|||
// write a test case to create the allocation with storage version and managing wallet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add negative tests as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see it. Can you mention the name please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mentioned in the chat to remove the negative tc—that wont work.
@@ -21,6 +21,31 @@ func TestCreateAllocation(testSetup *testing.T) { | |||
|
|||
t.Parallel() | |||
|
|||
// write a test case to create the allocation with storage version and managing wallet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see it. Can you mention the name please?
scWallet.Nonce = int(walletBalance.Nonce) | ||
|
||
// todo: check logic | ||
apiClient.KillBlobber(t, scWallet, killBlobberReq, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add it in defer func.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
"size": "1024", | ||
"read_price": "0-1", | ||
"write_price": "0-1", | ||
"storage_version": 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep it storage version 1.
blobber := apiClient.GetBlobber(t, blobberID, client.HttpOkStatus) | ||
require.NotEqual(t, wallet.Id, blobber.StakePoolSettings.DelegateWallet) | ||
|
||
blobber.StorageVersion = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set to 1. We only have 0 and 1 for now.
blobber := apiClient.GetBlobber(t, blobberID, client.HttpOkStatus) | ||
require.NotEqual(t, wallet.Id, blobber.StakePoolSettings.DelegateWallet) | ||
|
||
blobber.StorageVersion = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set to 0. We only have 0 and 1 for now.
delegateWallet, err := getWalletForName(t, configPath, escapedTestName(t)+"_delegate") | ||
require.Nil(t, err, "error occurred when getting delegate wallet") | ||
|
||
// todo: not able to upate the version of blobber. Only v4 will have managing wallet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort our TODOs.
tests/api_tests/main_test.go
Outdated
@@ -151,8 +192,12 @@ type WalletFile struct { | |||
|
|||
func createWallet(t *test.SystemTest) *model.Wallet { | |||
walletMutex.Lock() | |||
|
|||
// generate random number for wallet idx | |||
walletIdx = int64(rand.Intn(len(initialisedWallets))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted create wallet
|
||
blobber.StorageVersion = 1 | ||
|
||
apiClient.UpdateBlobber(t, wallet, blobber, client.TxUnsuccessfulStatus) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add getBlobber to verify version is added properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added get blopbber to verify the version
|
||
blobber.StorageVersion = 0 | ||
|
||
apiClient.UpdateBlobber(t, wallet, blobber, client.TxUnsuccessfulStatus) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added get blobber to verify the version
tests/cli_tests/config/config.yaml
Outdated
confirmation_chain_length: 3 | ||
ethereum_node_url: "https://rpc.tenderly.co/fork/5b7ffac9-50cc-4169-b0ca-6fd203d26ef6" | ||
ethereum_node_url: "https://virtual.mainnet.rpc.tenderly.co/1b2b3323-9a80-49c3-a2ff-50efb7afb359" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted
confirmation_chain_length: 3 | ||
ethereum_node_url: "https://rpc.tenderly.co/fork/5b7ffac9-50cc-4169-b0ca-6fd203d26ef6" | ||
ethereum_node_url: "https://virtual.mainnet.rpc.tenderly.co/1b2b3323-9a80-49c3-a2ff-50efb7afb359" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted
output, err := updateBlobberInfo(t, configPath, createParams(map[string]interface{}{ | ||
"blobber_id": intialBlobberInfo.ID, | ||
"delegate_wallet": delegateWallet.ClientID, | ||
"storage_version": 4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove storage version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storage version removed
}) | ||
|
||
// update blobber: managing wallet should be able to udpate delegate wallet | ||
t.RunSequentially("update blobber managing wallet should be able to update delegate wallet", func(t *test.SystemTest) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add cleanup : revert back the original delegate wallet
@@ -21,6 +21,30 @@ func TestCreateAllocation(testSetup *testing.T) { | |||
|
|||
t.Parallel() | |||
|
|||
// write a test case to create the allocation with storage version | |||
t.Run("Create allocation with storage version", func(t *test.SystemTest) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add negative tests
Added System Tests for new storage version changes