Skip to content

Commit

Permalink
Address CR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sabarasaba committed Sep 22, 2021
1 parent 45e26b8 commit 5b76125
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('ES deprecations table', () => {
const mlDeprecation = esDeprecationsMockResponse.deprecations[0];
const reindexDeprecation = esDeprecationsMockResponse.deprecations[3];

// Since upgradeStatusMockResponse includes ML and reindex actions (which require fetching status), there will be 3 requests made
// Since upgradeStatusMockResponse includes ML and reindex actions (which require fetching status), there will be 4 requests made
expect(server.requests.length).toBe(totalRequests + 4);
expect(server.requests[server.requests.length - 4].url).toBe(
`${API_BASE_PATH}/es_deprecations`
Expand All @@ -75,6 +75,10 @@ describe('ES deprecations table', () => {
expect(server.requests[server.requests.length - 2].url).toBe(
`${API_BASE_PATH}/reindex/${reindexDeprecation.index}`
);

expect(server.requests[server.requests.length - 1].url).toBe(
`${API_BASE_PATH}/ml_upgrade_mode`
);
});

it('shows critical and warning deprecations count', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('Machine learning deprecation flyout', () => {
expect(find('mlSnapshotDetails.upgradeSnapshotButton').text()).toEqual('Retry upgrade');
});

it('Doesnt allow to take actions if ml_upgrade_mode is enabled', async () => {
it('Disables actions if ml_upgrade_mode is enabled', async () => {
httpRequestsMockHelpers.setLoadMlUpgradeModeResponse({ mlUpgradeModeEnabled: true });

await act(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const i18nTexts = {
<EuiLink href={docsLink} target="_blank" data-test-subj="setUpgradeModeDocsLink">
<FormattedMessage
id="xpack.upgradeAssistant.esDeprecations.mlSnapshots.upgradeModeEnabledDocsLink"
defaultMessage="Documentation"
defaultMessage="Learn more"
/>
</EuiLink>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export const EsDeprecationsTable: React.FunctionComponent<Props> = ({
services: { api },
} = useAppContext();

const { data } = api.useLoadMLUpgradeMode();
const { data } = api.useLoadMlUpgradeMode();
const mlUpgradeModeEnabled = !!data?.mlUpgradeModeEnabled;

const [sortConfig, setSortConfig] = useState<SortConfig>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class ApiService {
});
}

public useLoadMLUpgradeMode() {
public useLoadMlUpgradeMode() {
return this.useRequest<{
mlUpgradeModeEnabled: boolean;
}>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describe('ML snapshots APIs', () => {
});

describe('GET /api/upgrade_assistant/ml_upgrade_mode', () => {
it('Knows how to retrieve ml upgrade mode', async () => {
it('Retrieves ml upgrade mode', async () => {
(
routeHandlerContextMock.core.elasticsearch.client.asCurrentUser.ml.info as jest.Mock
).mockResolvedValue({
Expand Down

0 comments on commit 5b76125

Please sign in to comment.