-
Notifications
You must be signed in to change notification settings - Fork 11
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
Feature/TR-5854/Detect delivery concurrency #2420
Feature/TR-5854/Detect delivery concurrency #2420
Conversation
$registry = PluginRegistry::getRegistry(); | ||
if (!$registry->isRegistered('taoQtiTest/runner/plugins/controls/session/preventConcurrency')) { |
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.
$registry = PluginRegistry::getRegistry(); | |
if (!$registry->isRegistered('taoQtiTest/runner/plugins/controls/session/preventConcurrency')) { | |
$registry = PluginRegistry::getRegistry(); | |
if (!$registry->isRegistered('taoQtiTest/runner/plugins/controls/session/preventConcurrency')) { |
$registry = PluginRegistry::getRegistry(); | ||
if ($registry->isRegistered('taoQtiTest/runner/plugins/controls/session/preventConcurrency')) { |
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.
$registry = PluginRegistry::getRegistry(); | |
if ($registry->isRegistered('taoQtiTest/runner/plugins/controls/session/preventConcurrency')) { | |
$registry = PluginRegistry::getRegistry(); | |
if ($registry->isRegistered('taoQtiTest/runner/plugins/controls/session/preventConcurrency')) { |
public function up(Schema $schema): void | ||
{ | ||
$registry = PluginRegistry::getRegistry(); | ||
if (!$registry->isRegistered('taoQtiTest/runner/plugins/controls/session/preventConcurrency')) { |
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.
We can store 'taoQtiTest/runner/plugins/controls/session/preventConcurrency'
in a separate class variable to avoid duplications 🙂
But not critical
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.
Done!
'bundle' => 'taoQtiTest/loader/testPlugins.min', | ||
'description' => 'Detect concurrent deliveries launched from the same user session', | ||
'category' => 'controls', | ||
'active' => true, |
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.
We discussed this will not be activated by default, right? Maybe we should set it to false?
*Even if it will be handled by feature flag later, maybe to be on the safe side, still worth to make it disabled by default to be consistent. Wdyt?
cc: @jsconan
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.
Actually, the feature is conditioned by a feature flag. We can install the plugin and have it always active, then set the feature flag FEATURE_FLAG_PAUSE_CONCURRENT_SESSIONS
when needed. This ways it will work all together with the backend feature.
@@ -9,6 +9,6 @@ | |||
"license": "GPL-2.0", | |||
"dependencies": { | |||
"@oat-sa/tao-test-runner": "^1.0.0", | |||
"@oat-sa/tao-test-runner-qti": "^4.0.0" | |||
"@oat-sa/tao-test-runner-qti": "https://github.com/oat-sa/tao-test-runner-qti-fe#feature/TR-5858/detect-delivery-concurrency" |
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.
- Please do not forget to update with proper version before merge
public function up(Schema $schema): void | ||
{ | ||
$registry = PluginRegistry::getRegistry(); | ||
if (!$registry->isRegistered('taoQtiTest/runner/plugins/controls/session/preventConcurrency')) { |
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.
Would not be easier to keep the plugin declaration configs on RegisterTestRunnerPlugins
and only get it here? Example (does not need to be the same)
$registry->register(TestPlugin::fromArray(RegisterTestRunnerPlugins::getPlugin('preventConcurrency')));
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.
We could, but we would need to refactor the class RegisterTestRunnerPlugins
.
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.
Suggestion applied
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.
Thanks!
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.
Thanks @jsconan !
- New code is covered by tests (if applicable)
- Tests are running successfully (old and new ones) on my local machine (if applicable)
- New code is respecting code style rules
- New code is respecting best practices
- New code is not subject to concurrency issues (if applicable)
- Feature is working correctly on my local machine (if applicable)
- Acceptance criteria are respected
- Pull request title and description are meaningful
Co-authored-by: Gabriel Felipe Soares <gabrielfs7@gmail.com> Signed-off-by: Jean-Sébastien CONAN <jsconan@gmail.com>
Co-authored-by: Héctor Arroyo <hector.arroyo@taotesting.com> Signed-off-by: Jean-Sébastien CONAN <jsconan@gmail.com>
Related to: https://oat-sa.atlassian.net/browse/TR-5854
Requires:
Summary
Add a mechanism for detecting concurrent delivery sessions.
Details
Install the
preventConcurrency
plugin.When the test runner initializes, a sequence number is stored in the browser's storage. Each time the duration is updated, the sequence number is read from the storage and compared with the value created at the beginning. If a discrepancy is discovered this means another test runner started meanwhile and updated the storage. A dialog message is presented to the user and the test runner is stopped.
How to test
The feature flag
FEATURE_FLAG_PAUSE_CONCURRENT_SESSIONS
needs to be set.feature/TR-5858/detect-delivery-concurrency
cd taoQtiTest/views && npm ci