-
Notifications
You must be signed in to change notification settings - Fork 35
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
Review StoredProc Reaction #103
Review StoredProc Reaction #103
Conversation
console.log(`Executing the stored proc: ${query}`); | ||
|
||
// Execute the query | ||
knex.raw(query).then(() => { |
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 could make this function async
and use await
/** | ||
* @param {Array} queryIds | ||
*/ | ||
function storedprocReactionManifest(queryIds) { |
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.
this could be pure yaml in the directory of your specific scenario
e2e-tests/simple-scenario/my.test.js
Outdated
|
||
|
||
test('Test StoredProc Reaction - AddedResultCommand', async () => { |
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.
Let's create a new scenario instead of extending the simple scenario.
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 investigated this a bit more and found out that jest actually does not allow two test scenarios to run sequentially. This sometimes caused a race condition in the postgres database and the e2e test to fail.
I think maybe it is better to move the setup of the postgres database outside of the individual test scenarios and include it as a part of the cluster setup process?
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.
It would be better if scenarios did not share things. We could use different DNS names for different PG instances. I think you can run tests serially with jest: https://jestjs.io/docs/cli#--runinband
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.
Gotcha so one postgres per scenario
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.
Working on it right 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.
You might also need to look into doing some kind of teardown per scenario, before it starts the next scenario.
|
||
|
||
|
||
CREATE TABLE "CommandResult" ( |
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 we still need 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.
The storedprocedure adds an item to this table. This is used to verify that the storedproc reaction is working
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.
but this is on the wrong scenario?
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.
Yeah I am moving this yaml
await dbClient.query(`INSERT INTO "Item" ("ItemId", "Name", "Category") VALUES (3, 'Drasi', '1')`); | ||
|
||
// sleep 35 seconds | ||
await new Promise(r => setTimeout(r, 15000)); |
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.
Is there a better way we can do this rather than sleeping 35 seconds?
Could we check every 1 second and timeout after 30 seconds?
Something like the .waitForChange
on on the signalr fixture.
await knex.raw(query); | ||
console.log("The query was executed successfully"); | ||
} catch (error) { | ||
console.log(error); |
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 it fails, we probably want the exception to bubble up to the event handler, so that it will return a 500 error back to DAPR, so that the message will not be acknowledged off the queue.
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.
Looking good
Description
e2e
folderType of change
Fixes: (https://dev.azure.com/azure-octo/Incubations/_boards/board/t/Drasi/User%20Stories?workitem=12558)