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

fix: enterprise blobber test #1143

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/ci-dev-st.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
description: 'branch of repo-snapshots to derive images and branches from.'
default: 'current-sprint'
required: true
is_enterprise:
description: 'deploy network with enterprise blobbers'
default: false
existing_network:
description: '(OPTIONAL): *EXISTING NETWORK* to run system tests against *INSTEAD OF* deploying a new network. [example: dev.0chain.net]'
default: ''
Expand Down Expand Up @@ -78,15 +81,15 @@ jobs:
force: 'false'

- name: "Deploy 0Chain"
if: github.event_name == 'push' || github.event.inputs.existing_network == ''
uses: 0chain/actions/deploy-0chain@master
uses: 0chain/actions/deploy-0chain@feature/add-egosdk-tokenomics-action
with:
repo_snapshots_branch: "${{ env.REPO_SNAPSHOTS_BRANCH }}"
kube_config: ${{ secrets[format('DEVSTKC', env.RUNNER_NUMBER)] }}
teardown_condition: "TESTS_PASSED"
SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }}
is_enterprise_blobbers: '${{ inputs.is_enterprise }}'
TENDERLY_VIRTUAL_TESTNET_RPC_ID: ""
graphnode_sc: ${{ secrets.GRAPHNODE_SC }}
graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }}
graphnode_ethereum_node_url: ""
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
75 changes: 40 additions & 35 deletions .github/workflows/enterprise-blobbers-tokenomics_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
repo_snapshots_branch: "${{ env.REPO_SNAPSHOTS_BRANCH }}"
network: ${{ env.NETWORK_URL }}
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
system_tests_branch: fix/enterprise-blobber-tests
deploy_report_page: true
archive_results: true
custom_go_sdk_version: feat/enterprise-blobber
Expand All @@ -93,6 +94,7 @@ jobs:
network: ${{ env.NETWORK_URL }}
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
deploy_report_page: true
system_tests_branch: fix/enterprise-blobber-tests
archive_results: true
run_flaky_tests: false
custom_go_sdk_version: feat/enterprise-blobber
Expand All @@ -115,6 +117,7 @@ jobs:
network: ${{ env.NETWORK_URL }}
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
deploy_report_page: true
system_tests_branch: fix/enterprise-blobber-tests
archive_results: true
run_flaky_tests: false
run_api_system_tests: false
Expand All @@ -138,6 +141,7 @@ jobs:
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
deploy_report_page: true
archive_results: true
system_tests_branch: fix/enterprise-blobber-tests
run_flaky_tests: false
run_api_system_tests: false
custom_go_sdk_version: feat/enterprise-blobber
Expand All @@ -160,6 +164,7 @@ jobs:
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }}
deploy_report_page: true
archive_results: true
system_tests_branch: fix/enterprise-blobber-tests
run_flaky_tests: false
custom_go_sdk_version: feat/enterprise-blobber
zbox_cli_branch: staging
Expand All @@ -174,38 +179,38 @@ jobs:
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
TENDERLY_VIRTUAL_TESTNET_RPC_ID: ""

notify_slack_on_failure:
runs-on: [ self-hosted, arc-runner ]
needs: [ system-tests ]
if: always() && (needs.system-tests.result == 'failure')
steps:
- name: "Notify Slack"
run: |
payload='{
"text": "'"<!here> Enterprise Blobber Tokenomics Nightly Tests - Current Sprint FAILED on $(echo ${GITHUB_REF#refs/heads/})!.\n View the test results on Github: https://github.com/0chain/system_test/actions/runs/${{ github.run_id }}"'",
"attachments": [
{
"text": "Enterprise Blobber Tokenomics Nightly Tests - Current sprint: FAILED ⚠️",
"color": "#ff0000"
}
]
}'
curl -X POST -H 'Content-type: application/json' --data "${payload}" ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }}

notify_slack_on_success:
runs-on: [ self-hosted, arc-runner ]
needs: [ system-tests ]
if: always() && (needs.system-tests.result == 'success')
steps:
- name: "Notify Slack"
run: |
payload='{
"text": "'"<!here> Enterprise Blobber Tokenomics Nightly Tests - Current Sprint PASSING on $(echo ${GITHUB_REF#refs/heads/})!.\n View the test results on Github: https://github.com/0chain/system_test/actions/runs/${{ github.run_id }}"'",
"attachments": [
{
"text": "Enterprise Blobber Tokenomics Nightly Tests - Current sprint: PASSED ✅",
"color": "#22bb33"
}
]
}'
curl -X POST -H 'Content-type: application/json' --data "${payload}" ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }}
# notify_slack_on_failure:
# runs-on: [ self-hosted, arc-runner ]
# needs: [ system-tests ]
# if: always() && (needs.system-tests.result == 'failure')
# steps:
# - name: "Notify Slack"
# run: |
# payload='{
# "text": "'"<!here> Enterprise Blobber Tokenomics Nightly Tests - Current Sprint FAILED on $(echo ${GITHUB_REF#refs/heads/})!.\n View the test results on Github: https://github.com/0chain/system_test/actions/runs/${{ github.run_id }}"'",
# "attachments": [
# {
# "text": "Enterprise Blobber Tokenomics Nightly Tests - Current sprint: FAILED ⚠️",
# "color": "#ff0000"
# }
# ]
# }'
# curl -X POST -H 'Content-type: application/json' --data "${payload}" ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }}
#
# notify_slack_on_success:
# runs-on: [ self-hosted, arc-runner ]
# needs: [ system-tests ]
# if: always() && (needs.system-tests.result == 'success')
# steps:
# - name: "Notify Slack"
# run: |
# payload='{
# "text": "'"<!here> Enterprise Blobber Tokenomics Nightly Tests - Current Sprint PASSING on $(echo ${GITHUB_REF#refs/heads/})!.\n View the test results on Github: https://github.com/0chain/system_test/actions/runs/${{ github.run_id }}"'",
# "attachments": [
# {
# "text": "Enterprise Blobber Tokenomics Nightly Tests - Current sprint: PASSED ✅",
# "color": "#22bb33"
# }
# ]
# }'
# curl -X POST -H 'Content-type: application/json' --data "${payload}" ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }}
Original file line number Diff line number Diff line change
Expand Up @@ -228,34 +228,6 @@ func TestCreateEnterpriseAllocation(testSetup *testing.T) {
createEnterpriseAllocationTestTeardown(t, allocationID)
})

t.Run("Create enterprise allocation with read price range Should Work", func(t *test.SystemTest) {
output, err := utils.CreateWallet(t, configPath)
require.Nil(t, err, "Error registering wallet", strings.Join(output, "\n"))

_, err = utils.ExecuteFaucetWithTokens(t, configPath, 10)
require.Nil(t, err, "Error executing faucet")

blobberAuthTickets, blobberIds := utils.GenerateBlobberAuthTickets(t, configPath)

options := map[string]interface{}{
"size": "1024",
"read_price": "0-9999",
"lock": "0.5",
"enterprise": true,
"blobber_auth_tickets": blobberAuthTickets,
"preferred_blobbers": blobberIds,
}
output, err = createNewEnterpriseAllocation(t, configPath, utils.CreateParams(options))
require.Nil(t, err, strings.Join(output, "\n"))
require.True(t, len(output) > 0, "expected output length be at least 1")
require.Regexp(t, regexp.MustCompile("^Allocation created: [0-9a-fA-F]{64}$"), output[0], strings.Join(output, "\n"))

allocationID, err := utils.GetAllocationID(output[0])
require.Nil(t, err, "could not get allocation ID", strings.Join(output, "\n"))

createEnterpriseAllocationTestTeardown(t, allocationID)
})

t.Run("Create enterprise allocation with write price range Should Work", func(t *test.SystemTest) {
output, err := utils.CreateWallet(t, configPath)
require.Nil(t, err, "Error registering wallet", strings.Join(output, "\n"))
Expand Down Expand Up @@ -598,23 +570,6 @@ func TestCreateEnterpriseAllocation(testSetup *testing.T) {
require.Contains(t, output[0], "blobbers provided are not enough to honour the allocation") //nolint
})

t.Run("Create enterprise allocation with read price range 0-0 Should Fail", func(t *test.SystemTest) {
output, err := utils.CreateWallet(t, configPath)
require.Nil(t, err, "Error registering wallet", strings.Join(output, "\n"))

_, err = utils.ExecuteFaucetWithTokens(t, configPath, 10)
require.Nil(t, err, "Error executing faucet")

blobberAuthTickets, blobberIds := utils.GenerateBlobberAuthTickets(t, configPath)

options := map[string]interface{}{"read_price": "0-0", "lock": "0.5", "size": 1024, "enterprise": true, "blobber_auth_tickets": blobberAuthTickets,
"preferred_blobbers": blobberIds}
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.Contains(t, output[0], "Not enough blobbers to honor the allocation", strings.Join(output, "\n"))
})

t.Run("Create enterprise allocation with size smaller than limit (size < 1024) Should Fail", func(t *test.SystemTest) {
output, err := utils.CreateWallet(t, configPath)
require.Nil(t, err, "Error registering wallet", strings.Join(output, "\n"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestFinalizeEnterpriseAllocation(testSetup *testing.T) {
require.Nil(t, err, "Error updating sc config", strings.Join(output, "\n"))
})

t.RunWithTimeout("Finalize allocation after waiting for 11 minutes check finalization and balance.", time.Minute*20, func(t *test.SystemTest) {
t.RunWithTimeout("Finalize allocation after waiting for 7 minutes check finalization and balance.", time.Minute*20, func(t *test.SystemTest) {
utils.SetupWalletWithCustomTokens(t, configPath, 10)

wallet, err := utils.GetWalletForName(t, configPath, utils.EscapedTestName(t))
Expand All @@ -62,7 +62,7 @@ func TestFinalizeEnterpriseAllocation(testSetup *testing.T) {
beforeBalance = afterBalance

t.Log("Waiting for 11 minutes ....")
waitForTimeInMinutesWhileLogging(t, 11)
waitForTimeInMinutesWhileLogging(t, 7)

// Finalize the allocation
output, err := finalizeAllocation(t, configPath, allocationID, true)
Expand Down Expand Up @@ -141,7 +141,7 @@ func TestFinalizeEnterpriseAllocation(testSetup *testing.T) {
output, err := utils.UpdateAllocation(t, configPath, updateAllocationParams, true)
require.Nil(t, err, "Updating allocation duration failed", strings.Join(output, "\n"))

waitForTimeInMinutesWhileLogging(t, 11)
waitForTimeInMinutesWhileLogging(t, 7)

// Finalize the allocation
output, err = finalizeAllocation(t, configPath, allocationID, true)
Expand Down
Loading