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

utils.createTestAccounts logic seems to count all network accounts #65

Open
mikedotexe opened this issue Dec 12, 2020 · 4 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@mikedotexe
Copy link
Contributor

mikedotexe commented Dec 12, 2020

It seems as though the utils.createTestAccounts method isn't as polished as we'd thought. It'll load all accounts for a network and count that against the numAccounts it's supposed to create. This wasn't spotted as easily before since the network local doesn't contain multiple accounts typically.

Shouldn't be a difficult task, just making sure to document it so it doesn't get lost.

Update: I think the actual task on this issue is to:

  1. Have the function createTestAccounts use the contract helper to create temporary accounts
  2. Use those accounts to run tests
  3. Delete the accounts, sending all tokens back to the network TLA (ex. betanet)
  4. Remove the restriction of passing in a master account to this function, remove environment variable from command, etc.
@mikedotexe
Copy link
Contributor Author

So the function as is does this:
"You told me to create 5 test accounts."
Option 1:
"I see that there are less than 5 accounts on your network that you control. So we're going to create subaccounts until we have 5"
Option 2:
"I see that there are at least 5 accounts on your network that you control, so I'm not going to create any and we'll use those in testing."
Is this okay? It's different than what I imagined, but perhaps this is fine. I am able to come up with angel's and devil's advocate for this behavior. Perhaps a nothingburger.

@artob
Copy link
Contributor

artob commented Dec 12, 2020

Is this okay? It's different than what I imagined, but perhaps this is fine. I am able to come up with angel's and devil's advocate for this behavior. Perhaps a nothingburger.

The betanet case would always fall under Option 2, right? Or what do you mean by "network that you control", would this heuristic apply to just localnet? How do you see all this working on betanet?

@artob artob added the bug Something isn't working label Dec 12, 2020
@mikedotexe
Copy link
Contributor Author

As an update to this, a conversation with @evgenykuzyakov finally made sense to me. I think ideally we would have the betanet/testnet/localnet create a test account programmatically using the NEAR Contract Helper instead of having the user specify which account should be doing the testing. This is the typical workflow for our other projects, except those have a dedicated ci environment.
I've updated the description on this issue to reflect what I think we need to do.

@artob
Copy link
Contributor

artob commented Dec 21, 2020

I think ideally we would have the betanet/testnet/localnet create a test account programmatically using the NEAR Contract Helper instead of having the user specify which account should be doing the testing. [...]
I've updated the description on this issue to reflect what I think we need to do.

That makes sense for the test networks where the Contract Helper is already available. However, note that having to install the Contract Helper locally in order to run with localnet would be a major hurdle compared getting set up locally right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants