Skip to content

Conversation

@idegtiarenko
Copy link
Contributor

currently, custom metadata integration test combines 3-4 test cases in
a single test method. This change split the test into separate scenarios
and removes code duplication.

currently, custom metadata integration test combines 3-4 test cases in
a single test method. This change split the test into separate scenarios
and removes code duplication.
@idegtiarenko idegtiarenko added :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >refactoring Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.1.0 labels Jan 18, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

var metadata = clusterAdmin().prepareState().get().getState().getMetadata();
logger.info("check that api custom metadata [{}] is visible via api", metadata);
assertThat(metadata.<ApiMetadata>custom(ApiMetadata.TYPE).getData(), equalTo("before_restart_s_gw"));
assertThat(metadata.<NonApiMetadata>custom(NonApiMetadata.TYPE), nullValue());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this checks also gateway and api may be the test class should be renamed to CustomMetadataScopeIT or CustomMetadataXContextIT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a stupid question, why do we need the <NonApiMetadata> here now?

Not sure about the renaming, maybe CustomMetadataContextIT would be more appropriate to point so we cover the word Context. But I'm indifferent tbh. as far as I'm concerned the current name is good enough too :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a stupid question, why do we need the here now?

This is needed to avoid explicit cast that we had here before:

assertThat(((SnapshottableMetadata) metadata.custom(SnapshottableMetadata.TYPE)).getData(), equalTo("before_snapshot_s"));

Not sure about the renaming, maybe CustomMetadataContextIT would be more appropriate to point so we cover the word Context. But I'm indifferent tbh. as far as I'm concerned the current name is good enough too :)

Then I would rename to CustomMetadataContextIT as half of the test cases here are not related to the snapshots.

Copy link
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

LGTM nice cleanup!

var metadata = clusterAdmin().prepareState().get().getState().getMetadata();
logger.info("check that api custom metadata [{}] is visible via api", metadata);
assertThat(metadata.<ApiMetadata>custom(ApiMetadata.TYPE).getData(), equalTo("before_restart_s_gw"));
assertThat(metadata.<NonApiMetadata>custom(NonApiMetadata.TYPE), nullValue());
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a stupid question, why do we need the <NonApiMetadata> here now?

Not sure about the renaming, maybe CustomMetadataContextIT would be more appropriate to point so we cover the word Context. But I'm indifferent tbh. as far as I'm concerned the current name is good enough too :)

# Conflicts:
#	server/src/internalClusterTest/java/org/elasticsearch/snapshots/CustomMetadataSnapshotIT.java
@idegtiarenko idegtiarenko merged commit febf22c into elastic:master Jan 20, 2022
@idegtiarenko idegtiarenko deleted the refactor_custom_metadata_it branch January 20, 2022 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >refactoring Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants