-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Ingest Manager] API sends 404 when package config id is missing #73212
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
Merged
jfsiii
merged 10 commits into
elastic:master
from
jfsiii:66388-fix-get-missing-package-config
Jul 28, 2020
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5a8d8b8
Add test to confirm missing config responds w/ 404
b4f4051
Use after() to remove items added by test.
e9dd263
Fix package config path in OpenApi spec
6019f64
Return 404 if package config id is invalid/missing
d04e6dc
Change test for error displayed text
e1a6718
Merge branch 'master' into 66388-fix-get-missing-package-config
elasticmachine f6b3876
Merge branch 'master' into 66388-fix-get-missing-package-config
elasticmachine 0e40685
Merge branch 'master' into 66388-fix-get-missing-package-config
elasticmachine 24319c4
Merge branch 'master' into 66388-fix-get-missing-package-config
elasticmachine edb23d4
Merge branch 'master' into 66388-fix-get-missing-package-config
elasticmachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
x-pack/test/ingest_manager_api_integration/apis/package_config/get.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import expect from '@kbn/expect'; | ||
| import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; | ||
| import { skipIfNoDockerRegistry } from '../../helpers'; | ||
|
|
||
| export default function (providerContext: FtrProviderContext) { | ||
| const { getService } = providerContext; | ||
| const supertest = getService('supertest'); | ||
| const dockerServers = getService('dockerServers'); | ||
|
|
||
| const server = dockerServers.get('registry'); | ||
| // use function () {} and not () => {} here | ||
| // because `this` has to point to the Mocha context | ||
| // see https://mochajs.org/#arrow-functions | ||
|
|
||
| describe('Package Config - get by id', async function () { | ||
| skipIfNoDockerRegistry(providerContext); | ||
| let agentConfigId: string; | ||
| let packageConfigId: string; | ||
|
|
||
| before(async function () { | ||
| if (!server.enabled) { | ||
| return; | ||
| } | ||
| const { body: agentConfigResponse } = await supertest | ||
| .post(`/api/ingest_manager/agent_configs`) | ||
| .set('kbn-xsrf', 'xxxx') | ||
| .send({ | ||
| name: 'Test config', | ||
| namespace: 'default', | ||
| }); | ||
| agentConfigId = agentConfigResponse.item.id; | ||
|
|
||
| const { body: packageConfigResponse } = await supertest | ||
| .post(`/api/ingest_manager/package_configs`) | ||
| .set('kbn-xsrf', 'xxxx') | ||
| .send({ | ||
| name: 'filetest-1', | ||
| description: '', | ||
| namespace: 'default', | ||
| config_id: agentConfigId, | ||
| enabled: true, | ||
| output_id: '', | ||
| inputs: [], | ||
| package: { | ||
| name: 'filetest', | ||
| title: 'For File Tests', | ||
| version: '0.1.0', | ||
| }, | ||
| }); | ||
| packageConfigId = packageConfigResponse.item.id; | ||
| }); | ||
|
|
||
| after(async function () { | ||
| if (!server.enabled) { | ||
| return; | ||
| } | ||
|
|
||
| await supertest | ||
| .post(`/api/ingest_manager/agent_configs/delete`) | ||
| .set('kbn-xsrf', 'xxxx') | ||
| .send({ agentConfigId }) | ||
| .expect(200); | ||
|
|
||
| await supertest | ||
| .post(`/api/ingest_manager/package_configs/delete`) | ||
| .set('kbn-xsrf', 'xxxx') | ||
| .send({ packageConfigIds: [packageConfigId] }) | ||
| .expect(200); | ||
| }); | ||
|
|
||
| it('should succeed with a valid id', async function () { | ||
| const { body: apiResponse } = await supertest | ||
| .get(`/api/ingest_manager/package_configs/${packageConfigId}`) | ||
| .expect(200); | ||
|
|
||
| expect(apiResponse.success).to.be(true); | ||
| }); | ||
|
|
||
| it('should return a 404 with an invalid id', async function () { | ||
| await supertest.get(`/api/ingest_manager/package_configs/IS_NOT_PRESENT`).expect(404); | ||
| }); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the relative path here because I was getting an error like "cannot find module 'src/core/server'" when I added the helpers