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

Move basic.py to where ci-cd will pick it up from #610

Merged
merged 31 commits into from
Dec 2, 2022
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0e2ba17
Move basic.py to where ci-cd will pick it up from
pouneh Nov 30, 2022
8511413
Remove comment, adjust libpath
pouneh Nov 30, 2022
956397d
Merge branch 'develop' into pouneh/integ-test/183925740
pouneh Nov 30, 2022
a50bef3
Import from python-library dir since the library doesn't live under t…
pouneh Nov 30, 2022
56392c6
Merge branch 'develop' into pouneh/integ-test/183925740
pouneh Nov 30, 2022
0546952
Merge branch 'pouneh/integ-test/183925740' of github.com:mobilecoinof…
pouneh Nov 30, 2022
f2c540f
Fix path
pouneh Nov 30, 2022
0375251
Update README
pouneh Nov 30, 2022
dbeda24
Make the sys.path.append more resilient
pouneh Nov 30, 2022
9e89651
Pass in config file to test
pouneh Nov 30, 2022
4846d07
oops: add missing import
pouneh Nov 30, 2022
991356b
Add a skeleton of what the config file should look like
pouneh Dec 1, 2022
15a1d47
Make changes to the test_config ignored
pouneh Dec 1, 2022
86ffe86
Change build/run scripts to treat {workdir} as location for local net…
pouneh Dec 1, 2022
73b67a6
Add cleanup step and better name some variables
pouneh Dec 1, 2022
0605c91
Add instructions for running the test locally
pouneh Dec 1, 2022
e66c413
Update readme with running stuff
pouneh Dec 1, 2022
55f6a86
Make sure testenv is cleaned up before we import account
pouneh Dec 1, 2022
8558d3f
add names to accoutns
pouneh Dec 1, 2022
ccb9709
Wait for account to sync
pouneh Dec 1, 2022
107267c
Create a preclean step
pouneh Dec 1, 2022
816df16
Cleanup
pouneh Dec 1, 2022
10ba19d
comments
pouneh Dec 1, 2022
05d47ce
Merge branch 'develop' into pouneh/integ-test/183925740
pouneh Dec 1, 2022
b8f6494
Unify sleeping time
pouneh Dec 1, 2022
78fa891
Merge branch 'pouneh/integ-test/183925740' of github.com:mobilecoinof…
pouneh Dec 1, 2022
d8514d9
Remove request logging completely
pouneh Dec 1, 2022
43b9b12
Wait for both accounts to sync
pouneh Dec 1, 2022
42c21d5
Reduce branching logic
pouneh Dec 2, 2022
3554a41
Add waiting for pending mob to settle
pouneh Dec 2, 2022
e69eaea
Remove cleanup steps (db get's locked?)
pouneh Dec 2, 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
Prev Previous commit
Next Next commit
Cleanup
  • Loading branch information
pouneh committed Dec 1, 2022
commit 816df16f7582f5569964b48b6d55b91629c71309
23 changes: 15 additions & 8 deletions .internal-ci/test/fs-integration/basic.py
Original file line number Diff line number Diff line change
@@ -35,22 +35,26 @@ async def wait_for_account_to_sync(id):


async def test_cleanup():
global account_ids
for id in account_ids:
await wait_for_account_to_sync(id)
await fs.remove_account(id)
accounts = await fs.get_accounts()
assert len(accounts.get('result').get('account_ids')) == 0, "Failed to clear out accounts"
for id in account_ids:
assert id not in accounts.get('result').get('account_ids'),"Failed to clear out accounts"
account_ids = []


# If this test fails before reaching the last cleanup step, we have leftover
# artifacts in the FS instance. We clean up those residual artifacts here.
# Note: Using a testing framework like pytest would allow us to bundle this in
# a test fixture
async def preclean_this_test():
alice = await get_account(0, "alice", True)
bob = await get_account(1, "bob", True)

await get_account(0, "alice", True)
await get_account(1, "bob", True)
await test_cleanup()


def get_mnemonics(n=2):
if n > len(config["Account Mnemonics"]):
raise ValueError("Not enough account available in config")
@@ -71,20 +75,24 @@ async def get_account(i, name="", okay_if_already_imported=False):
assert "error" not in account.keys(), "Failed to import account"

if "error" not in account.keys():
return Account(account["result"]["account"])
result = Account(account["result"]["account"])
account_ids.append(result.id)
return result
else:
if len(account_ids) <= i:
accounts_response = Response(await fs.get_accounts())
account_ids = accounts_response.account_ids
return accounts_response.accounts[account_ids[i]]
else:
return Response(await fs.get_account_status(account_ids[i])).account
result = Response(await fs.get_account_status(account_ids[i])).account
account_ids.append(result.id)
return result


async def main():
while (await fs.get_wallet_status())['result']['wallet_status']['is_synced_all'] != True:
await asyncio.sleep(1)
print(await does_it_go())
await does_it_go()


async def does_it_go(amount_pmob: int = 600000000) -> bool:
@@ -156,7 +164,6 @@ async def does_it_go(amount_pmob: int = 600000000) -> bool:
assert alice_balance_0 == alice_balance_1 + fee + pmob_to_send, "Alice doesn't end with the expected amount"
assert bob_balance_1 == bob_balance_0 + pmob_to_send, "Bob doesn't end with the expected amount"

# TODO: stick this in a finally block
await test_cleanup()

if __name__ == "__main__":