Skip to content
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

Open
wants to merge 24 commits into
base: sprint-1.18
Choose a base branch
from

Conversation

Akhilesh53
Copy link
Collaborator

Added System Tests for new storage version changes

tests/api_tests/update_blobber_test.go Outdated Show resolved Hide resolved
@@ -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
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

tests/cli_tests/zboxcli_blobber_config_update_test.go Outdated Show resolved Hide resolved
tests/cli_tests/zboxcli_blobber_config_update_test.go Outdated Show resolved Hide resolved
@@ -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
Copy link
Collaborator

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?

tests/cli_tests/zboxcli_blobber_config_update_test.go Outdated Show resolved Hide resolved
tests/cli_tests/zboxcli_blobber_config_update_test.go Outdated Show resolved Hide resolved
scWallet.Nonce = int(walletBalance.Nonce)

// todo: check logic
apiClient.KillBlobber(t, scWallet, killBlobberReq, 1)
Copy link
Collaborator

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.

Copy link
Collaborator Author

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,
Copy link
Collaborator

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.

tests/cli_tests/zboxcli_blobber_config_update_test.go Outdated Show resolved Hide resolved
blobber := apiClient.GetBlobber(t, blobberID, client.HttpOkStatus)
require.NotEqual(t, wallet.Id, blobber.StakePoolSettings.DelegateWallet)

blobber.StorageVersion = 2
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort our TODOs.

@@ -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)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert it.

Copy link
Collaborator Author

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)
Copy link
Collaborator

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.

Copy link
Collaborator Author

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Collaborator Author

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

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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert

Copy link
Collaborator Author

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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert

Copy link
Collaborator Author

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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove storage version

Copy link
Collaborator Author

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) {
Copy link
Collaborator

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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add negative tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants