-
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?
Changes from 13 commits
d6ce4fa
e23eb70
3260704
661649d
1b901a4
7a58d52
0fbbf19
14e1448
3925208
e08bee3
e9209b9
0ad10c8
d2ce41f
f8adc96
3e77b7d
715d39e
1113363
24d2df6
fa04281
0c1c812
c2ee733
84f1103
03a9165
6f7bb5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
block_worker: https://dev.zus.network/dns | ||
0box_url: http://0box.dev.devnet-0chain.net | ||
block_worker: https://dev-st.devnet-0chain.net/dns | ||
0box_url: http://0box.dev-st.devnet-0chain.net | ||
0box_phone_number: +917696229925 | ||
zvault_url: http://zvault.dev.devnet-0chain.net | ||
zauth_url: http://zauth.dev.devnet-0chain.net | ||
default_test_case_timeout: 45s | ||
zs3_server_url: https://dev.0chain.net/zs3server/ | ||
chimney_test_network: https://dev.zus.network/dns | ||
zs3_server_url: https://dev-st.devnet-0chain.net/zs3server/ | ||
chimney_test_network: https://dev-st.devnet-0chain.net/dns | ||
blobber_owner_wallet_mnemonics: "economy day fan flower between rebuild valid bid catch bargain vivid hybrid room permit check manage mean twelve damage summer close churn boat either" | ||
owner_wallet_mnemonics: "cactus panther essence ability copper fox wise actual need cousin boat uncover ride diamond group jacket anchor current float rely tragic omit child payment" | ||
ethereum_address: 0xD8c9156e782C68EE671C09b6b92de76C97948432 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"client_id": "1746b06bb09f55ee01b33b5e2e055d6cc7a900cb57c0a3a5eaabb8a0e7745802", | ||
"client_key": "7b630ba670dac2f22d43c2399b70eff378689a53ee03ea20957bb7e73df016200fea410ba5102558b0c39617e5afd2c1843b161a1dedec15e1ab40543a78a518", | ||
"keys": [ | ||
{ | ||
"public_key": "7b630ba670dac2f22d43c2399b70eff378689a53ee03ea20957bb7e73df016200fea410ba5102558b0c39617e5afd2c1843b161a1dedec15e1ab40543a78a518", | ||
"private_key": "c06b6f6945ba02d5a3be86b8779deca63bb636ce7e46804a479c50e53c864915" | ||
} | ||
], | ||
"mnemonics": "cactus panther essence ability copper fox wise actual need cousin boat uncover ride diamond group jacket anchor current float rely tragic omit child payment", | ||
"version": "1.0", | ||
"date_created": "2023-11-26T01:23:58Z" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,47 @@ func TestRegisterBlobber(testSetup *testing.T) { | |
t := test.NewSystemTest(testSetup) | ||
t.Parallel() | ||
|
||
// write a test case to register a blobber with storage version | ||
t.Run("Register blobber with storage version", func(t *test.SystemTest) { | ||
wallet := createWallet(t) | ||
|
||
walletBalance := apiClient.GetWalletBalance(t, wallet, client.HttpOkStatus) | ||
t.Logf("wallet balance: %v", wallet) | ||
wallet.Nonce = int(walletBalance.Nonce) | ||
|
||
sn := &model.StorageNode{} | ||
|
||
sn.ID = uuid.New().String() | ||
sn.BaseURL = generateRandomURL() | ||
|
||
sn.Capacity = 10240 * GB | ||
sn.Terms.ReadPrice = 1000000000 | ||
sn.Terms.WritePrice = 1000000000 | ||
|
||
sn.StakePoolSettings.DelegateWallet = "config.Configuration.DelegateWallet" | ||
sn.StakePoolSettings.NumDelegates = 2 | ||
sn.StakePoolSettings.ServiceCharge = 0.2 | ||
|
||
//todo: make check to this | ||
sn.StorageVersion = 2 | ||
sn.ManagingWallet = wallet.Id | ||
|
||
apiClient.RegisterBlobberWithIdVerification(t, wallet, sn, 1, wallet.Id) | ||
|
||
var killBlobberReq = &model.KillBlobberRequest{ | ||
ProviderID: wallet.Id, | ||
} | ||
|
||
scWallet := initialiseSCWallet() | ||
|
||
// get wallet balance | ||
walletBalance = apiClient.GetWalletBalance(t, scWallet, client.HttpOkStatus) | ||
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
}) | ||
|
||
t.Run("Write price lower than min_write_price should not allow register", func(t *test.SystemTest) { | ||
wallet := createWallet(t) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,47 @@ func TestUpdateBlobber(testSetup *testing.T) { | |
|
||
t.Parallel() | ||
|
||
t.Run("update blobber version should work", func(t *test.SystemTest) { | ||
wallet := createWallet(t) | ||
|
||
blobberRequirements := model.DefaultBlobberRequirements(wallet.Id, wallet.PublicKey) | ||
allocationBlobbers := apiClient.GetAllocationBlobbers(t, wallet, &blobberRequirements, client.HttpOkStatus) | ||
allocationID := apiClient.CreateAllocation(t, wallet, allocationBlobbers, client.TxSuccessfulStatus) | ||
|
||
allocation := apiClient.GetAllocation(t, allocationID, client.HttpOkStatus) | ||
|
||
blobberID := getFirstUsedStorageNodeID(allocationBlobbers.Blobbers, allocation.Blobbers) | ||
require.NotZero(t, blobberID) | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Set to 1. We only have 0 and 1 for now. |
||
|
||
apiClient.UpdateBlobber(t, wallet, blobber, client.TxUnsuccessfulStatus) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Added get blopbber to verify the version |
||
}) | ||
|
||
t.Run("update blobber: degrade version should not work", func(t *test.SystemTest) { | ||
wallet := createWallet(t) | ||
|
||
blobberRequirements := model.DefaultBlobberRequirements(wallet.Id, wallet.PublicKey) | ||
allocationBlobbers := apiClient.GetAllocationBlobbers(t, wallet, &blobberRequirements, client.HttpOkStatus) | ||
|
||
allocationID := apiClient.CreateAllocation(t, wallet, allocationBlobbers, client.TxSuccessfulStatus) | ||
|
||
allocation := apiClient.GetAllocation(t, allocationID, client.HttpOkStatus) | ||
|
||
blobberID := getFirstUsedStorageNodeID(allocationBlobbers.Blobbers, allocation.Blobbers) | ||
require.NotZero(t, blobberID) | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Set to 0. We only have 0 and 1 for now. |
||
|
||
apiClient.UpdateBlobber(t, wallet, blobber, client.TxUnsuccessfulStatus) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Added get blobber to verify the version |
||
}) | ||
|
||
t.Run("Update blobber in allocation without correct delegated client, shouldn't work", func(t *test.SystemTest) { | ||
wallet := createWallet(t) | ||
|
||
|
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