-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: Renamed algorandFixture
's beforeEach
to newScope
#362
base: main
Are you sure you want to change the base?
Conversation
…it clearer in intent and ensured that accounts that are registered are copied across successive contexts fix: Resolved bug in transactionLogger.waitForIndexer to only wait for the last transaction, not all logged transactions (which caused problems)
@@ -84,7 +131,7 @@ The `fixture.context` property is of type [`AlgorandTestAutomationContext`](../c | |||
- `transactionLogger: TransactionLogger` - Transaction logger that will log transaction IDs for all transactions issued by `algod` | |||
- `testAccount: Account` - Funded test account that is ephemerally created for each test | |||
- `generateAccount: (params: GetTestAccountParams) => Promise<Account>` - Generate and fund an additional ephemerally created account | |||
- `waitForIndexer: () => Promise<void>` - Wait for the indexer to catch up with all transactions logged by transactionLogger | |||
- `waitForIndexer()` - Waits for indexer to catch up with that latest transaction that has been captured by the `transactionLogger` in the Algorand fixture |
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.
- `waitForIndexer()` - Waits for indexer to catch up with that latest transaction that has been captured by the `transactionLogger` in the Algorand fixture | |
- `waitForIndexer()` - Waits for indexer to catch up with the latest transaction that has been captured by the `transactionLogger` in the Algorand fixture |
@@ -170,7 +217,7 @@ This means it's easy to create tests that are flaky and have intermittent test f | |||
The testing capability provides mechanisms for waiting for indexer to catch up, namely: | |||
|
|||
- `algotesting.runWhenIndexerCaughtUp(run: () => Promise<T>)` - Executes the given action every 200ms up to 20 times until there is no longer an error with a `status` property with `404` and then returns the result of the action; this will work for any call that calls indexer APIs expecting to return a single record | |||
- `algorandFixture.waitForIndexer()` - Waits for indexer to catch up with all transactions that have been captured by the `transactionLogger` in the Algorand fixture | |||
- `algorandFixture.waitForIndexer()` - Waits for indexer to catch up with that latest transaction that has been captured by the `transactionLogger` in the Algorand fixture |
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.
- `algorandFixture.waitForIndexer()` - Waits for indexer to catch up with that latest transaction that has been captured by the `transactionLogger` in the Algorand fixture | |
- `algorandFixture.waitForIndexer()` - Waits for indexer to catch up with the latest transaction that has been captured by the `transactionLogger` in the Algorand fixture |
@@ -84,21 +84,26 @@ export function algorandFixture(fixtureConfig?: AlgorandFixtureConfig, config?: | |||
const indexer = fixtureConfig.indexer ?? ClientManager.getIndexerClient(fixtureConfig.indexerConfig!) | |||
const kmd = fixtureConfig.kmd ?? ClientManager.getKmdClient(fixtureConfig.kmdConfig!) | |||
let context: AlgorandTestAutomationContext | |||
let algorand: AlgorandClient | |||
let algorand = AlgorandClient.fromClients({ algod, indexer, kmd }) |
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.
If a dev is using this before calling newScope
, then the effect of detecting localnet and increasing the default validity window will not have run.
I'm wondering if we even need to create a default instance on calling the algorandFixture
function?
This makes it clearer in intent and ensured that accounts that are registered are copied across successive contexts.
fix: Resolved bug in transactionLogger.waitForIndexer to only wait for the last transaction, not all logged transactions (which caused problems)