Skip to content

Commit

Permalink
[Snapshot Restore] Fix broken Snapshot restore form (#161113)
Browse files Browse the repository at this point in the history
Fix #160974
Fix #160929

## Summary

From Es 8.10, the `version` field from the Get Snapshot response has a
different format - it will no longer be a string representing the
release version, but rather it will be a string representing the version
id (see
#160974 (comment)
for more details).

This PR replaces the use of the `version` field with the `versionId`
field when checking in the Snapshot Restore form if the current version
is greater than 7.12 (which corresponds to `versionID` 7120099).
The PR also unskips the functional test that failed with the promotion
of Es to 8.10.

**How to test:**

1. Start Es with `yarn es snapshot -E path.repo=./tmp/snap` and Kibana
with `yarn start`
2. Go to Stack Management -> Snapshot and Restore
3. Create a Shared File System repository with location `./tmp/snap`
4. Create a policy that uses the repository created in the previous
step.
5. Run the policy to create a snapshot.
6. Go to the Snapshots tab and click the Restore button for the created
snapshot.
7. Verify that the Snapshot restore form works as expected.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
ElenaStoeva and kibanamachine authored Jul 27, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 6d2603b commit fa90a2f
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@

import React, { Fragment, useState, useMemo } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import semverGt from 'semver/functions/gt';
import {
EuiButtonEmpty,
EuiDescribedFormGroup,
@@ -61,7 +60,7 @@ export const RestoreSnapshotStepLogistics: React.FunctionComponent<StepProps> =
indices: unfilteredSnapshotIndices,
dataStreams: snapshotDataStreams = [],
includeGlobalState: snapshotIncludeGlobalState,
version,
versionId,
featureStates: snapshotIncludeFeatureStates,
} = snapshotDetails;

@@ -647,8 +646,10 @@ export const RestoreSnapshotStepLogistics: React.FunctionComponent<StepProps> =
defaultMessage="Restores the configuration, history, and other data stored in Elasticsearch by a feature such as Elasticsearch security."
/>

{/* Only display callout if includeFeatureState is enabled and the snapshot was created by ES 7.12+ */}
{semverGt(version, '7.12.0') && isFeatureStatesToggleEnabled && (
{/* Only display callout if includeFeatureState is enabled and the snapshot was created by ES 7.12+
The versionId field represents the build id of the ES version. We check if the current ES version is >7.12
by comparing its build id with the build id of ES 7.12, which is 7120099. */}
{versionId > 7120099 && isFeatureStatesToggleEnabled && (
<>
<EuiSpacer size="s" />
<SystemIndicesOverwrittenCallOut featureStates={restoreSettings?.featureStates} />
Original file line number Diff line number Diff line change
@@ -15,8 +15,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const es = getService('es');
const security = getService('security');

// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/160929
describe.skip('Snapshot restore', function () {
describe('Snapshot restore', function () {
before(async () => {
await security.testUser.setRoles(['snapshot_restore_user'], { skipBrowserRefresh: true });
await pageObjects.common.navigateToApp('snapshotRestore');

0 comments on commit fa90a2f

Please sign in to comment.