-
Notifications
You must be signed in to change notification settings - Fork 61
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
Adding UTs for IndexReplicationTask #109
Conversation
Things added in main code path :
|
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 bootstrapping UTs. Looks good for start.
src/test/kotlin/org/opensearch/replication/task/index/IndexReplicationTaskTests.kt
Outdated
Show resolved
Hide resolved
// Delay to let task execute | ||
delay(1000) |
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.
Nit - yield
is a better way to yield back instead of delay.
|
||
} | ||
|
||
open class NoOpClient(testName :String) : NoOpNodeClient(testName) { |
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.
Seems like this could be extracted out and can also be helpful for other 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.
I have extracted out from IndexReplicationTaskTests , but kept it in the same package as it needs all variables like follower index et all and is IndexReplicationTask specific as of now.
var taskManager = Mockito.mock(TaskManager::class.java) | ||
replicationTask.setPersistent(taskManager) | ||
var rc = ReplicationContext(followerIndex) | ||
var rm = ReplicationMetadata(connectionName, ReplicationStoreMetadataType.INDEX.name, ReplicationOverallState.RUNNING.name, "reason", rc, rc, Settings.EMPTY) |
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.
Minor: We can probably move the logic to create ReplicationMetadata
, ClusterState
, etc objects to a helper utility
Description
Adding UTs for IndexReplicationTask
Issues Resolved
#108
Check List
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.