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

More e2e Cleanups and Improvements #1756

Merged
merged 8 commits into from
Nov 6, 2023
Merged

More e2e Cleanups and Improvements #1756

merged 8 commits into from
Nov 6, 2023

Conversation

wilwade
Copy link
Collaborator

@wilwade wilwade commented Nov 3, 2023

Goal

The goal of this PR is another pile of small e2e fixes and cleanups

Part of #1731

Discussion

  • Correctly name time release test
  • Move some msa tests into a separate file
  • Staking calls should always use signAndSend
  • Test handles for > 90 runs by using a random number generator
  • createMsa helper and using it for creating un-permissioned MSAs
  • Replace the rxjs with the apiPromise for rpc and state queries because they are faster and more reliable
  • getCapacity and DrainCapacity Improvements and cleanups
  • Serialize BigInts for Mocha (as sometimes it needs to serialize it)

Testing

  • make e2e-tests


const failStakeObj = ExtrinsicHelper.stake(stakeKeys, maxMsaId + 1, stakeAmount);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this test is running in parallel, it cannot just use maxMsaId + 1 as other msas are being created and might be providers.

@@ -38,212 +36,4 @@ describe("Create Accounts", function () {
});
});
});

describe("addPublicKeyToMsa", function () {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to msaKeyManagemement.test.ts for less dependent tests

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from msa/createMsa.test.ts

@@ -221,10 +221,6 @@ export class ExtrinsicHelper {
return ExtrinsicHelper.apiPromise.query.schemas.governanceSchemaModelMaxBytes();
}

public static getCurrentMsaIdentifierMaximum() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now unused.

@@ -407,20 +424,19 @@ export async function getOrCreateAvroChatMessageItemizedSchema(source: KeyringPa

export const TokenPerCapacity = 50n;

export function assertEvent(events: EventMap, eventName: string) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved down with the other assert

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was missing .test.ts so it wasn't running.

@wilwade wilwade enabled auto-merge (squash) November 3, 2023 20:21
Copy link
Collaborator

@JoeCap08055 JoeCap08055 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

const totalCapacity = (await getRemainingCapacity(stakeProviderId)).toBigInt();
async function drainCapacity(call, stakeProviderId: u64): Promise<bigint> {
const totalCapacity = (await getCapacity(stakeProviderId)).totalCapacityIssued.toBigInt();
let nonce = await getNonce(call.keys);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I didn't know you could do that.

Copy link
Contributor

@rlaferla rlaferla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@wilwade wilwade merged commit fef5364 into main Nov 6, 2023
27 checks passed
@wilwade wilwade deleted the testing/small-cleanups branch November 6, 2023 15:59
Copy link
Collaborator

@mattheworris mattheworris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@rlaferla rlaferla restored the testing/small-cleanups branch November 21, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants