Skip to content

Commit

Permalink
revert command error outputs for enterprise blobbers tokenomics tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
yash10019coder committed Sep 5, 2024
1 parent 8729719 commit d4c2560
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func TestCancelEnterpriseAllocation(testSetup *testing.T) {

require.Error(t, err, "expected error canceling allocation", strings.Join(output, "\n"))
require.True(t, len(output) > 0, "expected output length be at least 1", strings.Join(output, "\n"))
require.Equal(t, "Error canceling allocation:smartcontract: alloc_cancel_failed: only owner can cancel an allocation", output[len(output)-1])
require.Equal(t, "Error canceling allocation:alloc_cancel_failed: only owner can cancel an allocation", output[len(output)-1])
})

t.Run("Cancel Non-existent Allocation Should Fail", func(t *test.SystemTest) {
Expand All @@ -355,7 +355,7 @@ func TestCancelEnterpriseAllocation(testSetup *testing.T) {
output, err := cancelAllocation(t, configPath, allocationID, false)

require.Error(t, err, "expected error updating allocation", strings.Join(output, "\n"))
require.Equal(t, "Error canceling allocation:smartcontract: alloc_cancel_failed: value not present", output[0])
require.Equal(t, "Error canceling allocation:alloc_cancel_failed: value not present", output[0])
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ func TestCreateEnterpriseAllocation(testSetup *testing.T) {
output, err = createNewEnterpriseAllocationWithoutRetry(t, configPath, utils.CreateParams(options))
require.NotNil(t, err, strings.Join(output, "\n"))
require.True(t, len(output) > 0, "expected output length be at least 1")
require.Equal(t, "Error creating allocation: smartcontract: allocation_creation_failed: invalid request: insufficient allocation size", output[0], strings.Join(output, "\n"))
require.Equal(t, "Error creating allocation: allocation_creation_failed: invalid request: insufficient allocation size", output[0], strings.Join(output, "\n"))
})

t.Run("Create enterprise allocation with no parameter (missing lock) Should Fail", func(t *test.SystemTest) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func TestFinalizeEnterpriseAllocation(testSetup *testing.T) {
output, err = finalizeAllocation(t, configPath, allocationID, false)
require.NotNil(t, err, "expected error updating allocation", strings.Join(output, "\n"))
require.True(t, len(output) > 0, "expected output length be at least 1", strings.Join(output, "\n"))
require.Equal(t, "Error finalizing allocation:smartcontract: fini_alloc_failed: allocation is not expired yet", output[0])
require.Equal(t, "Error finalizing allocation:fini_alloc_failed: allocation is not expired yet", output[0])
})

t.Run("Finalize Other's Allocation Should Fail", func(t *test.SystemTest) {
Expand All @@ -206,7 +206,7 @@ func TestFinalizeEnterpriseAllocation(testSetup *testing.T) {
// Error should not be nil since finalize is not working
require.NotNil(t, err, "expected error finalizing allocation", strings.Join(output, "\n"))
require.True(t, len(output) > 0, "expected output length be at least 1", strings.Join(output, "\n"))
require.Equal(t, "Error finalizing allocation:smartcontract: fini_alloc_failed: not allowed, unknown finalization initiator", output[len(output)-1])
require.Equal(t, "Error finalizing allocation:fini_alloc_failed: not allowed, unknown finalization initiator", output[len(output)-1])
})

t.Run("No allocation param should fail", func(t *test.SystemTest) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func TestReplaceEnterpriseBlobberAllocation(testSetup *testing.T) {
t := test.NewSystemTest(testSetup)

var (
replaceBlobberWithSameIdFailRegex = `^Error updating allocation:smartcontract: allocation_updating_failed: cannot add blobber [a-f0-9]{64}, already in allocation$`
replaceBlobberWithWrongIdFailRegex = `^Error updating allocation:smartcontract: allocation_updating_failed: can't get blobber (.+)$`
replaceBlobberWithSameIdFailRegex = `^Error updating allocation:allocation_updating_failed: cannot add blobber [a-f0-9]{64}, already in allocation$`
replaceBlobberWithWrongIdFailRegex = `^Error updating allocation:allocation_updating_failed: can't get blobber (.+)$`
)

output, err := utils.CreateWallet(t, configPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ func TestUpdateEnterpriseAllocation(testSetup *testing.T) {

require.Error(t, err, "expected error updating allocation", strings.Join(output, "\n"))
require.Len(t, output, 1)
require.Equal(t, "Error updating allocation:smartcontract: allocation_updating_failed: allocation can't be reduced", output[0])
require.Equal(t, "Error updating allocation:allocation_updating_failed: allocation can't be reduced", output[0])

alloc := utils.GetAllocation(t, allocationID)

Expand All @@ -970,7 +970,7 @@ func TestUpdateEnterpriseAllocation(testSetup *testing.T) {

require.NotNil(t, err, "expected error updating allocation", strings.Join(output, "\n"))
require.True(t, len(output) > 0, "expected output length be at least 1", strings.Join(output, "\n"))
require.Equal(t, "Error updating allocation:smartcontract: allocation_updating_failed: update allocation changes nothing", output[0])
require.Equal(t, "Error updating allocation:allocation_updating_failed: update allocation changes nothing", output[0])

// Cleanup
output, err = cancelAllocation(t, configPath, allocationID, true)
Expand Down Expand Up @@ -1023,7 +1023,7 @@ func TestUpdateEnterpriseAllocation(testSetup *testing.T) {
require.NotNil(t, err, "expected error updating "+
"allocation", strings.Join(output, "\n"))
require.Len(t, output, 1)
require.Equal(t, "Error updating allocation:smartcontract: allocation_updating_failed: only owner can update the allocation", output[0])
require.Equal(t, "Error updating allocation:allocation_updating_failed: only owner can update the allocation", output[0])
})

t.Run("Update Mistake Size Parameter Should Fail", func(t *test.SystemTest) {
Expand Down

0 comments on commit d4c2560

Please sign in to comment.