Skip to content
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

SNAPSHOT: Introduce ClusterState Tests #35867

Conversation

original-brownbear
Copy link
Member

* Bringing in cluster state test infrastructure
* Relates elastic#32265
@original-brownbear original-brownbear added >non-issue >test Issues or PRs that are addressing/adding tests :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v7.0.0 labels Nov 23, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@original-brownbear
Copy link
Member Author

Jenkins test this

1 similar comment
@original-brownbear
Copy link
Member Author

Jenkins test this

@original-brownbear
Copy link
Member Author

Jenkins test this

doAnswer(invocationOnMock -> {
ClusterStateUpdateTask task = (ClusterStateUpdateTask)invocationOnMock.getArguments()[1];
result[0] = task.execute(state);
assertTrue(clusterStateResult.complete(task.execute(state)));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to allow us to get the result of an asynchronously completing action triggered by the runnable and added the assertion to make sure we're only ever handling a single state update here.

@original-brownbear
Copy link
Member Author

@ywelsch how about this for the next step in this effort? Also, I wonder if we actually have to limit this to the feature branch. There's only a visibility change as far as production code changes go, maybe fine to target master here?

);
state = cluster.deleteSnapshot(state, new DeleteSnapshotRequest("test-repo", "test-snap"));
assertNotNull(state.custom(SnapshotsInProgress.TYPE));
// TODO: This should be 1, but we're currently leaving one aborted entry behind
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would it take to fix this? What other tests could we possibly add here? Move this tests (and other new ones) to their own test class?

Copy link
Member Author

@original-brownbear original-brownbear Nov 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would it take to fix this?

I am not quite sure in concrete code in the SnapshotService. I could not isolate the change in your branch that gets us the clean-up of these entries. But correct me if I'm wrong here, if we don't leave these entry states behind, that will also require a change to SnapshotShardsService to correctly handle the cleanup without them won't it (you did some larger changes to that behaviour in SnapshotShardsService#processIndexShardSnapshots)?
=> I think this is a bigger change?

What other tests could we possibly add here?

I guess we could add a number of tests to look into all the possible branches that SnapshotService and SnapshotShardsService could run into. It looks to me (did some debugging when trying to understand the code better) like many of the error handling and corner cases don't have any coverage currently (at least not in unit-tests).

Move this tests (and other new ones) to their own test class?

Given the above -> sounds good, will do :)

@original-brownbear
Copy link
Member Author

@ywelsch I extracted the tests to their own class. Let me know if this is an ok step :)

@original-brownbear
Copy link
Member Author

Closing in favor of #36644

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >non-issue >test Issues or PRs that are addressing/adding tests v7.0.0-beta1 WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants