-
Notifications
You must be signed in to change notification settings - Fork 105
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
Add backwards compatibility tests #199
Conversation
Signed-off-by: Mohammad Qureshi <[email protected]>
…tions Signed-off-by: Mohammad Qureshi <[email protected]>
Is there a reason we are using the snapshot version of alerting 1.1 zip? |
… manually uploading Signed-off-by: Mohammad Qureshi <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #199 +/- ##
============================================
+ Coverage 78.83% 78.86% +0.02%
+ Complexity 215 214 -1
============================================
Files 172 172
Lines 6951 6964 +13
Branches 905 908 +3
============================================
+ Hits 5480 5492 +12
- Misses 986 987 +1
Partials 485 485
Continue to review full report at Codecov.
|
I updated the newest artifact to be generated automatically but I think it will always be the snapshot since that's the default for most recent point-in-time artifact being built. |
// on time | ||
// TODO: Should probably change the next execution time of the Monitor manually instead since this inflates | ||
// the test execution by a lot | ||
Thread.sleep(60000) |
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.
Can we avoid sleep(...) ?
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 had originally planned on adding a utility method like what ISM had added:
As well as a waitFor
wrapper so we could add assertions that could wait for the Monitor to execute and confirm state afterwards:
However, it looks like the JobScheduler implementation of the schedule information stores things like start_time
which is convenient to modify for the particular scheduled job you'd like to speed up in test scenarios:
Alerting's scheduled job implementation does not do this and instead uses enabled_time
to resolve the next expected execution time only if the expectedPreviousExecutionTime
is not set, otherwise it uses that:
val expectedPreviousExecutionTimeEpochMillis = (expectedPreviousExecutionTime ?: enabledTime).toEpochMilli() |
The expectedPreviousExecutionTime
is stored in scheduledJobIdToInfo
which is part of a concurrent hashmap which is stored in memory as far as I'm aware:
alerting/core/src/main/kotlin/org/opensearch/alerting/core/schedule/JobScheduler.kt
Line 52 in e0e41df
private val scheduledJobIdToInfo = ConcurrentHashMap<String, ScheduledJobInfo>() |
This would make modification of an already running Monitor to execute sooner less trivial than expected. I'd like to leave it out of scope of this particular PR for now and have it be a possible follow-up for a test refactor.
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.
Hmm, looks like these tests do get run automatically as part of ./gradlew build
so this would impact build times when running all tests. I was hoping to exclude them unless running something like ./gradlew bwcTestSuite
to avoid the overhead for the time being but ./gradlew build
will likely pick up all tests by nature.
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 for diving deep into this. Currently gradlew build
takes around 4mins, this sleep would add one more min.
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, since the bwcTestSuite
executes the following scenarios:
mixedCluster
- Hits theMIXED
caserollingUpgrade
- Hits theMIXED
andUPGRADED
casefullRestart
- Hits theUPGRADED
case
We'd be adding 4 minutes of sleep across all the tests since both the MIXED
and UPGRADED
cases are adding a sleep of 1 minute before verifying.
alerting/src/test/kotlin/org/opensearch/alerting/bwc/AlertingBackwardsCompatibilityIT.kt
Show resolved
Hide resolved
alerting/src/test/kotlin/org/opensearch/alerting/bwc/AlertingBackwardsCompatibilityIT.kt
Show resolved
Hide resolved
Signed-off-by: Mohammad Qureshi <[email protected]>
Signed-off-by: Mohammad Qureshi <[email protected]>
@qreshi Please confirm if |
I checked and it looks like it's not excluding the dependent tasks which run the BWC tests. This could be because they're defined as |
* Initial commit for BWC tests Signed-off-by: Mohammad Qureshi <[email protected]> * Update bwc test to check Monitor stats and add bwc tests to GitHub Actions Signed-off-by: Mohammad Qureshi <[email protected]> * Use current version plugin bundle from build for bwc tests instead of manually uploading Signed-off-by: Mohammad Qureshi <[email protected]> * Update mockito-core dependency to 3.12.4 to prevent conflict Signed-off-by: Mohammad Qureshi <[email protected]> * Remove disabling security manager flag when running BWC tests Signed-off-by: Mohammad Qureshi <[email protected]>
* Initial commit for BWC tests Signed-off-by: Mohammad Qureshi <[email protected]> * Update bwc test to check Monitor stats and add bwc tests to GitHub Actions Signed-off-by: Mohammad Qureshi <[email protected]> * Use current version plugin bundle from build for bwc tests instead of manually uploading Signed-off-by: Mohammad Qureshi <[email protected]> * Update mockito-core dependency to 3.12.4 to prevent conflict Signed-off-by: Mohammad Qureshi <[email protected]> * Remove disabling security manager flag when running BWC tests Signed-off-by: Mohammad Qureshi <[email protected]>
* Updates alerting version to 1.2 (#192) * Updates alerting version to 1.2 * Adds snapshot repo to the repository file Signed-off-by: Clay Downs <[email protected]> * Update build to use public Maven repo (#184) Signed-off-by: Abbas Hussain <[email protected]> * Publish notification JARs checksums. (#196) * Publish notification JARs checksums. Signed-off-by: dblock <[email protected]> * Remove sonatype staging. Signed-off-by: dblock <[email protected]> * Updates testCompile mockito version to match OpenSearch changes (#204) Signed-off-by: Clay Downs <[email protected]> * Update maven publication to include cksums. (#224) This change adds a task to publish to a local staging repo under build/ that includes cksums. It also updates build.sh to use this new task and copy the contents of the staging repo to the output directory. The maven publish plugin will not include these cksums when publishing to maven local but will when published to a separate folder. Signed-off-by: Marc Handalian <[email protected]> * Add release notes for 1.2.0.0 release (#225) * Create opensearch-alerting.release-notes-1.2.0.0.md Signed-off-by: Annie Lee <[email protected]> * Update opensearch-alerting.release-notes-1.2.0.0.md * Update opensearch-alerting.release-notes-1.2.0.0.md * Add backwards compatibility tests (#199) * Initial commit for BWC tests Signed-off-by: Mohammad Qureshi <[email protected]> * Update bwc test to check Monitor stats and add bwc tests to GitHub Actions Signed-off-by: Mohammad Qureshi <[email protected]> * Use current version plugin bundle from build for bwc tests instead of manually uploading Signed-off-by: Mohammad Qureshi <[email protected]> * Update mockito-core dependency to 3.12.4 to prevent conflict Signed-off-by: Mohammad Qureshi <[email protected]> * Remove disabling security manager flag when running BWC tests Signed-off-by: Mohammad Qureshi <[email protected]> Co-authored-by: Clay Downs <[email protected]> Co-authored-by: Abbas Hussain <[email protected]> Co-authored-by: Daniel Doubrovkine (dB.) <[email protected]> Co-authored-by: Marc Handalian <[email protected]> Co-authored-by: Annie Lee <[email protected]> Co-authored-by: Mohammad Qureshi <[email protected]>
* Cherry-pick commits to 1.x (#227) * Update copyright notice (#222) Signed-off-by: Mohammad Qureshi <[email protected]> * Admin Users must be able to access all monitors #139 (#220) * Admin Users must be able to access all monitors #139 * Refactored Co-authored-by: Mohammad Qureshi <[email protected]> Co-authored-by: Sriram <[email protected]> * Updates alerting version to 1.2 (#192) * Updates alerting version to 1.2 * Adds snapshot repo to the repository file Signed-off-by: Clay Downs <[email protected]> * Update build to use public Maven repo (#184) Signed-off-by: Abbas Hussain <[email protected]> * Publish notification JARs checksums. (#196) * Publish notification JARs checksums. Signed-off-by: dblock <[email protected]> * Remove sonatype staging. Signed-off-by: dblock <[email protected]> * Updates testCompile mockito version to match OpenSearch changes (#204) Signed-off-by: Clay Downs <[email protected]> * Update maven publication to include cksums. (#224) This change adds a task to publish to a local staging repo under build/ that includes cksums. It also updates build.sh to use this new task and copy the contents of the staging repo to the output directory. The maven publish plugin will not include these cksums when publishing to maven local but will when published to a separate folder. Signed-off-by: Marc Handalian <[email protected]> * Add release notes for 1.2.0.0 release (#225) * Create opensearch-alerting.release-notes-1.2.0.0.md Signed-off-by: Annie Lee <[email protected]> * Update opensearch-alerting.release-notes-1.2.0.0.md * Update opensearch-alerting.release-notes-1.2.0.0.md * Add backwards compatibility tests (#199) * Initial commit for BWC tests Signed-off-by: Mohammad Qureshi <[email protected]> * Update bwc test to check Monitor stats and add bwc tests to GitHub Actions Signed-off-by: Mohammad Qureshi <[email protected]> * Use current version plugin bundle from build for bwc tests instead of manually uploading Signed-off-by: Mohammad Qureshi <[email protected]> * Update mockito-core dependency to 3.12.4 to prevent conflict Signed-off-by: Mohammad Qureshi <[email protected]> * Remove disabling security manager flag when running BWC tests Signed-off-by: Mohammad Qureshi <[email protected]> Co-authored-by: Mohammad Qureshi <[email protected]> Co-authored-by: Sriram <[email protected]> Co-authored-by: Clay Downs <[email protected]> Co-authored-by: Abbas Hussain <[email protected]> Co-authored-by: Daniel Doubrovkine (dB.) <[email protected]> Co-authored-by: Marc Handalian <[email protected]> Co-authored-by: Annie Lee <[email protected]>
* Updates alerting version to 1.2 (opensearch-project#192) * Updates alerting version to 1.2 * Adds snapshot repo to the repository file Signed-off-by: Clay Downs <[email protected]> * Update build to use public Maven repo (opensearch-project#184) Signed-off-by: Abbas Hussain <[email protected]> * Publish notification JARs checksums. (opensearch-project#196) * Publish notification JARs checksums. Signed-off-by: dblock <[email protected]> * Remove sonatype staging. Signed-off-by: dblock <[email protected]> * Updates testCompile mockito version to match OpenSearch changes (opensearch-project#204) Signed-off-by: Clay Downs <[email protected]> * Update maven publication to include cksums. (opensearch-project#224) This change adds a task to publish to a local staging repo under build/ that includes cksums. It also updates build.sh to use this new task and copy the contents of the staging repo to the output directory. The maven publish plugin will not include these cksums when publishing to maven local but will when published to a separate folder. Signed-off-by: Marc Handalian <[email protected]> * Add release notes for 1.2.0.0 release (opensearch-project#225) * Create opensearch-alerting.release-notes-1.2.0.0.md Signed-off-by: Annie Lee <[email protected]> * Update opensearch-alerting.release-notes-1.2.0.0.md * Update opensearch-alerting.release-notes-1.2.0.0.md * Add backwards compatibility tests (opensearch-project#199) * Initial commit for BWC tests Signed-off-by: Mohammad Qureshi <[email protected]> * Update bwc test to check Monitor stats and add bwc tests to GitHub Actions Signed-off-by: Mohammad Qureshi <[email protected]> * Use current version plugin bundle from build for bwc tests instead of manually uploading Signed-off-by: Mohammad Qureshi <[email protected]> * Update mockito-core dependency to 3.12.4 to prevent conflict Signed-off-by: Mohammad Qureshi <[email protected]> * Remove disabling security manager flag when running BWC tests Signed-off-by: Mohammad Qureshi <[email protected]> Co-authored-by: Clay Downs <[email protected]> Co-authored-by: Abbas Hussain <[email protected]> Co-authored-by: Daniel Doubrovkine (dB.) <[email protected]> Co-authored-by: Marc Handalian <[email protected]> Co-authored-by: Annie Lee <[email protected]> Co-authored-by: Mohammad Qureshi <[email protected]> Signed-off-by: AWSHurneyt <[email protected]>
Issue #, if available: #147
Description of changes:
DEVELOPER_GUIDE
to add instructions for running bwc testsA couple improvements that can probably be made in future iterations:
toXContent
method that is being used in the current version of the plugin test is not forwards compatible, so we would need a workaround or some legacytoXContent
method forMonitor
if we want to use therandomMonitor()
helper method for creating the Monitor requestWe can generate the current version of the artifact dynamically and place it in the expected file path when running the bwc tests so we don't have to place an artifact there each time we move the versions along (ex. the 1.1 Alerting version being used is undersrc/test/resources/bwc/alerting/1.1.0.0-SNAPSHOT/opensearch-alerting-1.1.0.0-SNAPSHOT.zip
)CheckList:
[x] Commits are signed per the DCO using --signoff
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.