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.
[test/api_integration] migrate api tests to functional test runner
- Loading branch information
Showing
23 changed files
with
429 additions
and
416 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default function ({ loadTestFile }) { | ||
describe('apis', () => { | ||
loadTestFile(require.resolve('./scripts')); | ||
loadTestFile(require.resolve('./search')); | ||
}); | ||
} |
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,5 @@ | ||
export default function ({ loadTestFile }) { | ||
describe('scripts', () => { | ||
loadTestFile(require.resolve('./languages')); | ||
}); | ||
} |
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,25 @@ | ||
import expect from 'expect.js'; | ||
|
||
export default function ({ getService }) { | ||
const supertest = getService('supertest'); | ||
|
||
describe('Script Languages API', function getLanguages() { | ||
it('should return 200 with an array of languages', () => ( | ||
supertest.get('/api/kibana/scripts/languages') | ||
.expect(200) | ||
.then((response) => { | ||
expect(response.body).to.be.an('array'); | ||
}) | ||
)); | ||
|
||
it('should only return langs enabled for inline scripting', () => ( | ||
supertest.get('/api/kibana/scripts/languages') | ||
.expect(200) | ||
.then((response) => { | ||
expect(response.body).to.contain('expression'); | ||
expect(response.body).to.contain('painless'); | ||
expect(response.body).to.not.contain('groovy'); | ||
}) | ||
)); | ||
}); | ||
} |
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,42 @@ | ||
import expect from 'expect.js'; | ||
|
||
export default function ({ getService }) { | ||
const esArchiver = getService('esArchiver'); | ||
const supertest = getService('supertest'); | ||
|
||
describe('Count API', function postIngest() { | ||
before(() => esArchiver.load('search/count')); | ||
after(() => esArchiver.unload('search/count')); | ||
|
||
it('should return 200 with a document count for existing indices', () => ( | ||
supertest | ||
.post('/api/kibana/foo-*/_count') | ||
.expect(200) | ||
.then((response) => { | ||
expect(response.body.count).to.be(2); | ||
}) | ||
)); | ||
|
||
it('should support GET requests as well', () => ( | ||
supertest | ||
.get('/api/kibana/foo-*/_count') | ||
.expect(200) | ||
.then((response) => { | ||
expect(response.body.count).to.be(2); | ||
}) | ||
)); | ||
|
||
it('should return 404 if a pattern matches no indices', () => ( | ||
supertest | ||
.post('/api/kibana/doesnotexist-*/_count') | ||
.expect(404) | ||
)); | ||
|
||
it('should return 404 if a concrete index does not exist', () => ( | ||
supertest | ||
.post('/api/kibana/concrete/_count') | ||
.expect(404) | ||
)); | ||
|
||
}); | ||
} |
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,5 @@ | ||
export default function ({ loadTestFile }) { | ||
describe('search', () => { | ||
loadTestFile(require.resolve('./count')); | ||
}); | ||
} |
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,26 @@ | ||
import { resolve } from 'path'; | ||
|
||
import { | ||
SupertestProvider, | ||
} from './services'; | ||
|
||
import { servers } from '../server_config'; | ||
|
||
export default async function ({ readConfigFile }) { | ||
const commonConfig = await readConfigFile(require.resolve('../common/config')); | ||
|
||
return { | ||
testFiles: [ | ||
require.resolve('./apis'), | ||
], | ||
services: { | ||
es: commonConfig.get('services.es'), | ||
esArchiver: commonConfig.get('services.esArchiver'), | ||
supertest: SupertestProvider, | ||
}, | ||
servers, | ||
esArchiver: { | ||
directory: resolve(__dirname, './fixtures/es_archives') | ||
}, | ||
}; | ||
} |
Binary file added
BIN
+158 Bytes
test/api_integration/fixtures/es_archives/search/count/data.json.gz
Binary file not shown.
Oops, something went wrong.