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

Feature/add coverage #282

Merged
merged 22 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6f80fc6
consume actions branch
stewartie4 May 9, 2022
ae21bcc
Merge branch 'master' into feature/add-api-tests-to-ci
stewartie4 May 9, 2022
5cd5aba
improve error logging
stewartie4 May 11, 2022
9515d95
Merge remote-tracking branch 'origin/feature/add-api-tests-to-ci' int…
stewartie4 May 11, 2022
d126d85
add nonce to txn hash calculation
stewartie4 May 11, 2022
f830ac9
use staging explorer image
stewartie4 May 12, 2022
73feca4
try set nonce to a different value
stewartie4 May 15, 2022
208a103
fix nonce calculation
stewartie4 May 21, 2022
0211c0c
fix nonce calculation
stewartie4 May 21, 2022
c5ecd6f
fix allocation creation request by calling new blobber alloc endpoint…
stewartie4 May 22, 2022
6b4e03e
Merge branch 'master' into feature/add-api-tests-to-ci
stewartie4 May 24, 2022
a6e4727
fix lint
stewartie4 May 24, 2022
447eacc
Merge remote-tracking branch 'origin/feature/add-api-tests-to-ci' int…
stewartie4 May 24, 2022
afb60a7
Merge branch 'master' into feature/add-api-tests-to-ci
stewartie4 May 25, 2022
a7da3cd
point ci code to master
stewartie4 May 25, 2022
a611e1a
Merge remote-tracking branch 'origin/feature/add-api-tests-to-ci' int…
stewartie4 May 25, 2022
1f90cc2
Merge branch 'master' of github.com:0chain/system_test into feature/a…
stewartie4 May 29, 2022
0aa562b
add coverage and bring some previously flaky tests back into circulation
stewartie4 May 29, 2022
d9ac890
fix message formatting, add additional logging
stewartie4 May 29, 2022
9ca8af1
fix message formatting, add additional logging
stewartie4 May 29, 2022
9ddc706
delete empty file
stewartie4 May 30, 2022
5c7c47e
remove fixme
stewartie4 May 30, 2022
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
2 changes: 2 additions & 0 deletions tests/api_tests/create_allocation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestCreateAllocation(t *testing.T) {
}

func createAllocation(t *testing.T, wallet *model.Wallet, keyPair model.KeyPair, blobberRequirements model.BlobberRequirements) (*model.TransactionResponse, *model.Confirmation) {
t.Logf("Creating allocation...")
txnDataString, err := json.Marshal(model.SmartContractTxnData{Name: "new_allocation_request", InputArgs: blobberRequirements})
require.Nil(t, err)
allocationRequest := model.Transaction{
Expand Down Expand Up @@ -61,6 +62,7 @@ func getAllocation(t *testing.T, allocationId string) *model.Allocation {
}

func getAllocationWithoutAssertion(t *testing.T, allocationId string) (*model.Allocation, *resty.Response, error) { //nolint
t.Logf("Retrieving allocation...")
balance, httpResponse, err := v1ScrestAllocation(t, allocationId)
return balance, httpResponse, err
}
3 changes: 3 additions & 0 deletions tests/api_tests/execute_faucet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func confirmTransaction(t *testing.T, wallet *model.Wallet, sentTransaction mode
}

func confirmTransactionWithoutAssertion(t *testing.T, hash string, maxPollDuration time.Duration) (*model.Confirmation, *resty.Response, error) { //nolint
t.Logf("Confirming transaction...")
confirmation, httpResponse, err := v1TransactionGetConfirmation(t, hash)

startPollTime := time.Now()
Expand All @@ -81,11 +82,13 @@ func getBalance(t *testing.T, clientId string) *model.Balance {
}

func getBalanceWithoutAssertion(t *testing.T, clientId string) (*model.Balance, *resty.Response, error) { //nolint
t.Logf("Getting balance...")
balance, httpResponse, err := v1ClientGetBalance(t, clientId)
return balance, httpResponse, err
}

func executeFaucet(t *testing.T, wallet *model.Wallet, keyPair model.KeyPair) *model.TransactionResponse {
t.Logf("Executing faucet...")
txnDataString, err := json.Marshal(model.SmartContractTxnData{Name: "pour"})
require.Nil(t, err)
faucetRequest := model.Transaction{
Expand Down
12 changes: 8 additions & 4 deletions tests/api_tests/get_blobbers_for_new_allocation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@ func TestGetBlobbersForNewAllocation(t *testing.T) {
t.Parallel()
registeredWallet, keyPair := registerWallet(t)
blobbers, blobberRequirements := getBlobbersMatchingRequirements(t, registeredWallet, keyPair, 2147483648, 2, 2, 3600000000000, time.Minute*2)
println("", blobbers)
json.Marshal(blobberRequirements)
require.NotNil(t, blobbers)
require.Greater(t, len(*blobbers), 3)
require.NotNil(t, blobberRequirements)
})

t.Run("Alloc blobbers API call should fail gracefully given valid request", func(t *testing.T) {
t.Parallel()
t.Skip("FIXME: lack of field validation leads to error")
blobbers, _, _ := v1ScrestAllocBlobbers(t, "{}")
println(blobbers)
blobbers, response, err := v1ScrestAllocBlobbers(t, "{}")
require.NotNil(t, blobbers)
require.NotNil(t, response)
require.NotNil(t, err)
})

}
Expand All @@ -40,6 +43,7 @@ func getBlobbersMatchingRequirements(t *testing.T, wallet *model.Wallet, keyPair
}

func getBlobbersMatchingRequirementsWithoutAssertion(t *testing.T, wallet *model.Wallet, keyPair model.KeyPair, size int64, dataShards int64, parityShards int64, maxChallengeCompletionTime int64, expiresIn time.Duration) (*[]string, model.BlobberRequirements, *resty.Response, error) { //nolint
t.Logf("Get blobbers for allocation...")
blobberRequirements := model.BlobberRequirements{
Size: size,
DataShards: dataShards,
Expand Down
1 change: 1 addition & 0 deletions tests/api_tests/register_wallet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func registerWalletForMnemonic(t *testing.T, mnemonic string) (*model.Wallet, mo
}

func registerWalletForMnemonicWithoutAssertion(t *testing.T, mnemonic string) (*model.Wallet, model.KeyPair, *resty.Response, error) { //nolint
t.Logf("Registering wallet...")
keyPair := crypto.GenerateKeys(t, mnemonic)
publicKeyBytes, _ := hex.DecodeString(keyPair.PublicKey.SerializeToHexStr())
clientId := crypto.Sha3256(publicKeyBytes)
Expand Down
24 changes: 0 additions & 24 deletions tests/cli_tests/flaky___broken_scenarios_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"os"
"path"
"path/filepath"
"regexp"
"strconv"
Expand Down Expand Up @@ -527,29 +526,6 @@ func Test___FlakyBrokenScenarios(t *testing.T) {
require.InEpsilon(t, totalChangeInWritePool, intToZCN(challengePool.Balance), epsilon, "expected challenge pool balance to match deducted amount from write pool [%v] but balance was actually [%v]", totalChangeInWritePool, intToZCN(challengePool.Balance))
})

t.Run("delete existing file in root directory with commit should work", func(t *testing.T) {
t.Parallel()

allocationID := setupAllocation(t, configPath)
defer createAllocationTestTeardown(t, allocationID)

remotepath := "/"
filesize := int64(1 * KB)
filename := generateFileAndUpload(t, allocationID, remotepath, filesize)
fname := filepath.Base(filename)
remoteFilePath := path.Join(remotepath, fname)

output, err := deleteFile(t, escapedTestName(t), createParams(map[string]interface{}{
"allocation": allocationID,
"remotepath": remoteFilePath,
"commit": true,
}), true)

// FIXME: error in deleting file with commit
require.NotNil(t, err, strings.Join(output, "\n"))
require.Len(t, output, 1)
})

// FIXME: Commented out because these cases hang the broken test suite till timeout

// FIXME: add param validation
Expand Down
Loading