forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] Test disabled API in serverless (elastic#161688)
- Loading branch information
Showing
6 changed files
with
110 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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
52 changes: 52 additions & 0 deletions
52
x-pack/test_serverless/api_integration/test_suites/observability/fleet.ts
This file contains 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,52 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from 'expect'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getService }: FtrProviderContext) { | ||
const svlCommonApi = getService('svlCommonApi'); | ||
const supertest = getService('supertest'); | ||
|
||
describe('fleet', function () { | ||
it('rejects request to create a new fleet server hosts', async () => { | ||
const { body, status } = await supertest | ||
.post('/api/fleet/fleet_server_hosts') | ||
.set(svlCommonApi.getCommonRequestHeader()) | ||
.send({ | ||
name: 'test', | ||
host_urls: ['https://localhost:8220'], | ||
}); | ||
|
||
// in a non-serverless environment this would succeed with a 200 | ||
expect(body).toEqual({ | ||
statusCode: 403, | ||
error: 'Forbidden', | ||
message: 'Fleet server host write APIs are disabled', | ||
}); | ||
expect(status).toBe(403); | ||
}); | ||
|
||
it('rejects request to create a new proxy', async () => { | ||
const { body, status } = await supertest | ||
.post('/api/fleet/proxies') | ||
.set(svlCommonApi.getCommonRequestHeader()) | ||
.send({ | ||
name: 'test', | ||
url: 'https://localhost:8220', | ||
}); | ||
|
||
// in a non-serverless environment this would succeed with a 200 | ||
expect(body).toEqual({ | ||
statusCode: 403, | ||
error: 'Forbidden', | ||
message: 'Proxies write APIs are disabled', | ||
}); | ||
expect(status).toBe(403); | ||
}); | ||
}); | ||
} |
This file contains 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
52 changes: 52 additions & 0 deletions
52
x-pack/test_serverless/api_integration/test_suites/security/fleet.ts
This file contains 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,52 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from 'expect'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getService }: FtrProviderContext) { | ||
const svlCommonApi = getService('svlCommonApi'); | ||
const supertest = getService('supertest'); | ||
|
||
describe('fleet', function () { | ||
it('rejects request to create a new fleet server hosts', async () => { | ||
const { body, status } = await supertest | ||
.post('/api/fleet/fleet_server_hosts') | ||
.set(svlCommonApi.getCommonRequestHeader()) | ||
.send({ | ||
name: 'test', | ||
host_urls: ['https://localhost:8220'], | ||
}); | ||
|
||
// in a non-serverless environment this would succeed with a 200 | ||
expect(body).toEqual({ | ||
statusCode: 403, | ||
error: 'Forbidden', | ||
message: 'Fleet server host write APIs are disabled', | ||
}); | ||
expect(status).toBe(403); | ||
}); | ||
|
||
it('rejects request to create a new proxy', async () => { | ||
const { body, status } = await supertest | ||
.post('/api/fleet/proxies') | ||
.set(svlCommonApi.getCommonRequestHeader()) | ||
.send({ | ||
name: 'test', | ||
url: 'https://localhost:8220', | ||
}); | ||
|
||
// in a non-serverless environment this would succeed with a 200 | ||
expect(body).toEqual({ | ||
statusCode: 403, | ||
error: 'Forbidden', | ||
message: 'Proxies write APIs are disabled', | ||
}); | ||
expect(status).toBe(403); | ||
}); | ||
}); | ||
} |
This file contains 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