diff --git a/.buildkite/scripts/steps/cloud/build_and_deploy.sh b/.buildkite/scripts/steps/cloud/build_and_deploy.sh index b6c2dcd0968e3..62f92b716b651 100755 --- a/.buildkite/scripts/steps/cloud/build_and_deploy.sh +++ b/.buildkite/scripts/steps/cloud/build_and_deploy.sh @@ -62,7 +62,7 @@ fi echo "--- Create Deployment" CLOUD_DEPLOYMENT_ID=$(ecctl deployment list --output json | jq -r '.deployments[] | select(.name == "'$CLOUD_DEPLOYMENT_NAME'") | .id') -if [ -z "${CLOUD_DEPLOYMENT_ID}" ]; then +if [ -z "${CLOUD_DEPLOYMENT_ID}" ] || [ "${CLOUD_DEPLOYMENT_ID}" = 'null' ]; then jq ' .resources.kibana[0].plan.kibana.docker_image = "'$KIBANA_CLOUD_IMAGE'" | .resources.elasticsearch[0].plan.elasticsearch.docker_image = "'$ELASTICSEARCH_CLOUD_IMAGE'" | diff --git a/.buildkite/scripts/steps/serverless/build_and_deploy.sh b/.buildkite/scripts/steps/serverless/build_and_deploy.sh index a78252e3baec0..3e69f4b4878b7 100644 --- a/.buildkite/scripts/steps/serverless/build_and_deploy.sh +++ b/.buildkite/scripts/steps/serverless/build_and_deploy.sh @@ -59,6 +59,11 @@ deploy() { -XPOST -d "$PROJECT_CREATE_CONFIGURATION" &>> $DEPLOY_LOGS PROJECT_ID=$(jq -r --slurp '.[1].id' $DEPLOY_LOGS) + if [ -z "${PROJECT_ID}" ] || [ "$PROJECT_ID" = 'null' ]; then + echo "Failed to create project. Deploy logs:" + cat $DEPLOY_LOGS + exit 1 + fi echo "Get credentials..." curl -s -XPOST -H "Authorization: ApiKey $PROJECT_API_KEY" \ diff --git a/src/cli_plugin/install/zip.test.js b/src/cli_plugin/install/zip.test.js index cdeb345951731..e651c3fe91284 100644 --- a/src/cli_plugin/install/zip.test.js +++ b/src/cli_plugin/install/zip.test.js @@ -15,7 +15,8 @@ import globby from 'globby'; import { analyzeArchive, extractArchive } from './zip'; -const getMode = (path) => (fs.statSync(path).mode & parseInt('777', 8)).toString(8); +const getExecFlags = (path) => + (fs.statSync(path).mode & parseInt('111', 8)).toString(8).padStart(3, '0'); describe('kibana cli', function () { describe('zip', function () { @@ -83,8 +84,8 @@ describe('kibana cli', function () { ] `); - expect(getMode(path.resolve(tempPath, 'executable'))).toEqual('755'); - expect(getMode(path.resolve(tempPath, 'not-executable'))).toEqual('644'); + expect(getExecFlags(path.resolve(tempPath, 'executable'))).toEqual('111'); + expect(getExecFlags(path.resolve(tempPath, 'not-executable'))).toEqual('000'); }); }); diff --git a/x-pack/plugins/cases/public/components/actions/assignees/edit_assignees_flyout.test.tsx b/x-pack/plugins/cases/public/components/actions/assignees/edit_assignees_flyout.test.tsx index 9001faa12a2a6..15ab25f9db223 100644 --- a/x-pack/plugins/cases/public/components/actions/assignees/edit_assignees_flyout.test.tsx +++ b/x-pack/plugins/cases/public/components/actions/assignees/edit_assignees_flyout.test.tsx @@ -10,22 +10,21 @@ import userEvent from '@testing-library/user-event'; import type { AppMockRenderer } from '../../../common/mock'; import { createAppMockRenderer } from '../../../common/mock'; import { basicCase } from '../../../containers/mock'; -import { waitForComponentToUpdate } from '../../../common/test_utils'; import { EditAssigneesFlyout } from './edit_assignees_flyout'; -import { waitFor } from '@testing-library/react'; +import { screen, waitFor } from '@testing-library/react'; +import { useBulkGetUserProfiles } from '../../../containers/user_profiles/use_bulk_get_user_profiles'; +import { useSuggestUserProfiles } from '../../../containers/user_profiles/use_suggest_user_profiles'; +import { userProfiles, userProfilesMap } from '../../../containers/user_profiles/api.mock'; -jest.mock('../../../containers/user_profiles/api'); +jest.mock('../../../containers/user_profiles/use_bulk_get_user_profiles'); +jest.mock('../../../containers/user_profiles/use_suggest_user_profiles'); -// Failing: See https://github.com/elastic/kibana/issues/174194 -// Failing: See https://github.com/elastic/kibana/issues/174195 -describe.skip('EditAssigneesFlyout', () => { +const useBulkGetUserProfilesMock = useBulkGetUserProfiles as jest.Mock; +const useSuggestUserProfilesMock = useSuggestUserProfiles as jest.Mock; + +describe('EditAssigneesFlyout', () => { let appMock: AppMockRenderer; - /** - * Case one has the following assignees: coke, pepsi, one - * Case two has the following assignees: one, three - * All available assignees are: one, two, three, coke, pepsi - */ const props = { selectedCases: [basicCase], onClose: jest.fn(), @@ -33,63 +32,57 @@ describe.skip('EditAssigneesFlyout', () => { }; beforeEach(() => { - appMock = createAppMockRenderer(); jest.clearAllMocks(); + appMock = createAppMockRenderer(); + + useBulkGetUserProfilesMock.mockReturnValue({ data: userProfilesMap }); + useSuggestUserProfilesMock.mockReturnValue({ data: userProfiles, isLoading: false }); }); it('renders correctly', async () => { - const result = appMock.render(); + appMock.render(); - expect(result.getByTestId('cases-edit-assignees-flyout')).toBeInTheDocument(); - expect(result.getByTestId('cases-edit-assignees-flyout-title')).toBeInTheDocument(); - expect(result.getByTestId('cases-edit-assignees-flyout-cancel')).toBeInTheDocument(); - expect(result.getByTestId('cases-edit-assignees-flyout-submit')).toBeInTheDocument(); - - await waitForComponentToUpdate(); + expect(await screen.findByTestId('cases-edit-assignees-flyout')).toBeInTheDocument(); + expect(await screen.findByTestId('cases-edit-assignees-flyout-title')).toBeInTheDocument(); + expect(await screen.findByTestId('cases-edit-assignees-flyout-cancel')).toBeInTheDocument(); + expect(await screen.findByTestId('cases-edit-assignees-flyout-submit')).toBeInTheDocument(); }); it('calls onClose when pressing the cancel button', async () => { - const result = appMock.render(); + appMock.render(); - userEvent.click(result.getByTestId('cases-edit-assignees-flyout-cancel')); - expect(props.onClose).toHaveBeenCalled(); + userEvent.click(await screen.findByTestId('cases-edit-assignees-flyout-cancel')); - await waitForComponentToUpdate(); + await waitFor(() => { + expect(props.onClose).toHaveBeenCalled(); + }); }); it('calls onSaveAssignees when pressing the save selection button', async () => { - const result = appMock.render(); + appMock.render(); - await waitForComponentToUpdate(); + expect(await screen.findByText('Damaged Raccoon')).toBeInTheDocument(); - await waitFor(() => { - expect(result.getByText('Damaged Raccoon')).toBeInTheDocument(); - }); - - userEvent.click(result.getByText('Damaged Raccoon')); - userEvent.click(result.getByTestId('cases-edit-assignees-flyout-submit')); + userEvent.click(await screen.findByText('Damaged Raccoon')); + userEvent.click(await screen.findByTestId('cases-edit-assignees-flyout-submit')); - expect(props.onSaveAssignees).toHaveBeenCalledWith({ - selectedItems: [], - unSelectedItems: ['u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0'], + await waitFor(() => { + expect(props.onSaveAssignees).toHaveBeenCalledWith({ + selectedItems: [], + unSelectedItems: ['u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0'], + }); }); }); it('shows the case title when selecting one case', async () => { - const result = appMock.render(); - - expect(result.getByText(basicCase.title)).toBeInTheDocument(); + appMock.render(); - await waitForComponentToUpdate(); + expect(await screen.findByText(basicCase.title)).toBeInTheDocument(); }); it('shows the number of total selected cases in the title when selecting multiple cases', async () => { - const result = appMock.render( - - ); - - expect(result.getByText('Selected cases: 2')).toBeInTheDocument(); + appMock.render(); - await waitForComponentToUpdate(); + expect(await screen.findByText('Selected cases: 2')).toBeInTheDocument(); }); }); diff --git a/x-pack/plugins/cases/public/components/all_cases/cases_metrics.test.tsx b/x-pack/plugins/cases/public/components/all_cases/cases_metrics.test.tsx index aeb6d46cd3a33..9105f82476891 100644 --- a/x-pack/plugins/cases/public/components/all_cases/cases_metrics.test.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/cases_metrics.test.tsx @@ -5,31 +5,57 @@ * 2.0. */ -import { waitFor, within } from '@testing-library/react'; +import { screen, within } from '@testing-library/react'; import React from 'react'; import type { AppMockRenderer } from '../../common/mock'; import { createAppMockRenderer } from '../../common/mock'; +import { useGetCasesMetrics } from '../../containers/use_get_cases_metrics'; +import { useGetCasesStatus } from '../../containers/use_get_cases_status'; import { CasesMetrics } from './cases_metrics'; -jest.mock('../../api'); +jest.mock('pretty-ms', () => jest.fn().mockReturnValue('2ms')); +jest.mock('../../containers/use_get_cases_metrics'); +jest.mock('../../containers/use_get_cases_status'); -// Failing: See https://github.com/elastic/kibana/issues/174300 -describe.skip('Cases metrics', () => { +const useGetCasesMetricsMock = useGetCasesMetrics as jest.Mock; +const useGetCasesStatusMock = useGetCasesStatus as jest.Mock; + +describe('Cases metrics', () => { let appMockRenderer: AppMockRenderer; beforeEach(() => { + useGetCasesMetricsMock.mockReturnValue({ isLoading: false, data: { mttr: 2000 } }); + useGetCasesStatusMock.mockReturnValue({ + isLoading: false, + data: { + countOpenCases: 20, + countInProgressCases: 40, + countClosedCases: 130, + }, + }); + appMockRenderer = createAppMockRenderer(); }); it('renders the correct stats', async () => { - const result = appMockRenderer.render(); - - await waitFor(() => { - expect(result.getByTestId('cases-metrics-stats')).toBeTruthy(); - expect(within(result.getByTestId('openStatsHeader')).getByText(20)).toBeTruthy(); - expect(within(result.getByTestId('inProgressStatsHeader')).getByText(40)).toBeTruthy(); - expect(within(result.getByTestId('closedStatsHeader')).getByText(130)).toBeTruthy(); - expect(within(result.getByTestId('mttrStatsHeader')).getByText('12s')).toBeTruthy(); - }); + appMockRenderer.render(); + + expect(await screen.findByTestId('cases-metrics-stats')).toBeInTheDocument(); + + expect( + within(await screen.findByTestId('openStatsHeader')).getByText('20') + ).toBeInTheDocument(); + + expect( + within(await screen.findByTestId('inProgressStatsHeader')).getByText('40') + ).toBeInTheDocument(); + + expect( + within(await screen.findByTestId('closedStatsHeader')).getByText('130') + ).toBeInTheDocument(); + + expect( + within(await screen.findByTestId('mttrStatsHeader')).getByText('2ms') + ).toBeInTheDocument(); }); }); diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/edit_query_delay.tsx b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/edit_query_delay.tsx index ad5703d54d884..0d2cd2fba4070 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/edit_query_delay.tsx +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/datafeed_chart_flyout/edit_query_delay.tsx @@ -34,6 +34,7 @@ export const EditQueryDelay: FC<{ queryDelay: Datafeed['query_delay']; isEnabled: boolean; }> = ({ datafeedId, queryDelay, isEnabled }) => { + const [currentQueryDelay, setCurrentQueryDelay] = useState(queryDelay); const [newQueryDelay, setNewQueryDelay] = useState(); const [isEditing, setIsEditing] = useState(false); const { updateDatafeed } = useMlApiContext(); @@ -45,6 +46,7 @@ export const EditQueryDelay: FC<{ datafeedId, datafeedConfig: { query_delay: newQueryDelay }, }); + setCurrentQueryDelay(newQueryDelay); displaySuccessToast( i18n.translate( 'xpack.ml.jobsList.datafeedChart.editQueryDelay.changesSavedNotificationMessage', @@ -120,7 +122,12 @@ export const EditQueryDelay: FC<{ - + { step('Go to test run page', async () => { await page.click(byTestId('superDatePickerToggleQuickMenuButton')); - await page.click('text=Last 1 year'); + await page.getByTestId('superDatePickerQuickMenu').getByLabel('Time value').fill('10'); + await page + .getByTestId('superDatePickerQuickMenu') + .getByLabel('Time unit') + .selectOption('Years'); + await page.getByTestId('superDatePickerQuickMenu').getByText('Apply').click(); + await page.mouse.wheel(0, 1000); await page.click(byTestId('row-ab240846-8d22-11ed-8fac-52bb19a2321e')); await page.waitForSelector('text=Test run details'); diff --git a/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor_project.ts b/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor_project.ts index f878e8bb40c70..1fb924a57a56e 100644 --- a/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor_project.ts +++ b/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor_project.ts @@ -13,7 +13,7 @@ import { ProjectMonitor } from '../../../common/runtime_types'; import { SYNTHETICS_API_URLS } from '../../../common/constants'; import { ProjectMonitorFormatter } from '../../synthetics_service/project_monitor/project_monitor_formatter'; -const MAX_PAYLOAD_SIZE = 1048576 * 20; // 20MiB +const MAX_PAYLOAD_SIZE = 1048576 * 50; // 20MiB export const addSyntheticsProjectMonitorRoute: SyntheticsRestApiRouteFactory = () => ({ method: 'PUT',