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

[APM] Update api tests to accomodate changes in API response #16

Merged
merged 4 commits into from
Mar 25, 2021

Conversation

sorenlouv
Copy link
Owner

@sorenlouv sorenlouv commented Mar 25, 2021

This is required by: elastic#95146.

in elastic#95146 all APM api's were updated to return objects. This PR updates the API tests accordingly.

Additionally it adds a type safe client (apmApiSupertest) which is based on the same types as the api client in APM.

cc @dgieselaar @smith @shahzad31

@@ -6,7 +6,7 @@
*/

import { FtrConfigProviderContext } from '@kbn/test/types/ftr';
import supertestAsPromised from 'supertest-as-promised';
import supertest from 'supertest';
Copy link
Owner Author

@sorenlouv sorenlouv Mar 25, 2021

Choose a reason for hiding this comment

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

supertest-as-promised is deprecated since 2016: WhoopInc/supertest-as-promised@ab56510

fyi: @spalger perhaps the dep should be removed from kibana entirely?

Copy link

Choose a reason for hiding this comment

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

It's planned elastic#95267

Copy link
Owner Author

@sorenlouv sorenlouv Mar 25, 2021

Choose a reason for hiding this comment

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

Wow, what a coincidence that I notice that the day after Tyler created that issue :D Great!

@sorenlouv sorenlouv changed the title [APM] Update api tests to accomodate changes in https://github.com/elastic/kibana/pull/95146 [APM] Update api tests to accomodate changes in API response Mar 25, 2021
);
try {
await createCustomLink(customLink);
expect(true).to.be(false);
Copy link

Choose a reason for hiding this comment

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

I don't?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thanks for the suggestions with expect.to.throwException. It looks much better:

expect(async () => {
  await createCustomLink(customLink);
}).to.throwException((e) => {
  expect(e.res.status).to.be(403);
  expectSnapshot(e.res.body.message).toMatchInline(
    `"To create custom links, you must be subscribed to an Elastic Gold license or above. With it, you'll have the ability to create custom links to improve your workflow when analyzing your services."`
  );
});

Unfortunately I couldn't make it work with promises. I'll merge this PR but will look into alternative options.

Copy link

@smith smith left a comment

Choose a reason for hiding this comment

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

This is very nice! Thank you.

@sorenlouv sorenlouv merged this pull request into add-apm-debug-mode-setting Mar 25, 2021
@sorenlouv sorenlouv deleted the update-api-tests branch March 25, 2021 19:41
sorenlouv pushed a commit that referenced this pull request Jun 1, 2022
* [Unified search] Create unified search plugin

* add unified_search into USES_STYLED_COMPONENTS

* fix JEST group 4

* update limits for data plugin

* fix: remove unifiedSearch plugin from x-pack/plugins/file_upload

* feat: updated .github/CODEOWNERS and set @elastic/kibana-app-services as a code owner

* apply PR comments

* [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs'

* feat: moved filter bar, apply filters folders and apply filter action from Data plugin to unified search plugin

* fix Checks

* fix Checks

* fix Linting and Default CI Group #16

* fix Checks

* fix Checks

* fix Linting (with types)

* fix show FILTER_BAR

* fix Jest Tests

* feat replece indexPatternsContranct in setIndexPatterns to DataViewsContract

* feat: removed unnecessary interface in unified search

* fix Checks

* fix Checks

* fix Jest Tests, Checks

* fix Checks

* resolve comments

Co-authored-by: Alexey Antonov <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
sorenlouv pushed a commit that referenced this pull request Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants