-
Notifications
You must be signed in to change notification settings - Fork 208
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
TS Integration Tests Framework #1244
Conversation
- codec - msg server - keeper skeleton - query server skeleton - genesis
- GetAirdropRecords - SetAirdropRecords - GetAllocationRecords - SetAllocationRecords
- rename test case to 'MsgCreateAirdrop' for clarity - set broadcastPollIntervalMs to 100ms for faster tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are BEAUTIFUL!! So excited to finally switch over to this, this will be a HUGE lift!
Mostly nit comments and then I would just gut the dockernet + CI changes and then lets merge this guy in!
while (true) { | ||
try { | ||
const block = | ||
await accounts.user.query.cosmos.base.tendermint.v1beta1.getLatestBlock( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have to execute all queries through a user like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes though it's the same query client. we can export it to a global query variable for these tests, but in general I've learned from secret that it's more convenient to have the query and tx clients under the same object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open to more feedback though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotchya - let's keep it for now and we can iterate on it!
Fwiw, the global query option sounds like a good option. I setup firehose with the query/tx client on the user and always felt like it was a bit of an antipattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious - what's the benefit you noticed from secret in having it be shared?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you just have the one StrideClient object, you can traverse it just like the cli
stridejs.query.bank.balance...
stridejs.tx.bank.send...
we've got a lot of good feedback on this after multiple iterations, but mostly that it's nice that you can explore the object with the ide's intelisense like you would explore the cli with typing half a command and appendig --help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah i see, yeah that makes a lot of sense! So do you normally just add stridejs = accounts.X
to the top of the test?
What are the different ways to send a tx? Cause I don't see anything txs in these tests like stridejs.tx.bank.send
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So do you normally just add stridejs = accounts.X to the top of the test?
I do, but it's a matter of personal preference.
What are the different ways to send a tx?
currently you can only create a message object and send it using signAndBroadcast()
, but I plan to add a function for each message.
For example, you'd be able to send a tx like that:
stridejs.tx.bank.send({from:x,to:y,amount:"1ustrd"})
or if you want to send multiple messages in the same tx then do something like that:
const msg1 = new MsgSend({from:x,to:y,amount:"1ustrd"})
const msg2 = new MsgSend({from:x,to:z,amount:"2ustrd"})
stridejs.tx.signAndBroadcast([msg1,msg2])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, make sense! I do think it breaks down a bit though when you have multiple accounts that you're sending txs from in one test. In which case, I could imagine it being cleaner to have a separate global query config
query.bank...
accounts.X.tx.bank.send(...)
accounts.Y.tx.bank.send(...)
But just ideating - obviously no need to change anything now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
… @cosmjs/stargate
…fs with stridejs docs(ts-tests/README.md): reformat instructions for better readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 !
- Stride-Labs/stride#1244 (comment) - Stride-Labs/stride#1244 (comment) also document `IbcTransferPath`
Adds a framework for writing integration tests using typescript, stridejs & dockernet.