Skip to content

Commit

Permalink
add mock alert data
Browse files Browse the repository at this point in the history
  • Loading branch information
angorayc committed May 25, 2021
1 parent 8b6e441 commit 5718037
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
10 changes: 10 additions & 0 deletions x-pack/test/functional/es_archives/rule_registry/alerts/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "doc",
"value": {
"index": ".alerts-observability-apm",
"source": {
"message": "hello world 1",
"kibana.rac.alert.owner": "apm"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"type": "index",
"value": {
"index": ".alerts-observability-apm",
"mappings": {
"properties": {
"message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"kibana.rac.alert.owner": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ import { getSpaceUrlPrefix } from '../../../common/lib/authentication/spaces';
export default ({ getService }: FtrProviderContext) => {
const supertestWithoutAuth = getService('supertestWithoutAuth');
const supertest = getService('supertest');
const TEST_URL = '/security-myfakepath';
const esArchiver = getService('esArchiver');

const TEST_URL = '/api/rac/alerts';
const SPACE1 = 'space1';
const SPACE2 = 'space2';

describe('rbac', () => {
before(async () => {
await esArchiver.load('rule_registry/alerts');
});
describe('Users:', () => {
for (const scenario of [
{ user: superUser },
Expand All @@ -39,7 +44,7 @@ export default ({ getService }: FtrProviderContext) => {
]) {
it(`${scenario.user.username} should be able to access the fake path in ${SPACE1}`, async () => {
await supertestWithoutAuth
.get(`${getSpaceUrlPrefix(SPACE1)}${TEST_URL}`)
.get(`${getSpaceUrlPrefix(SPACE1)}${TEST_URL}/?id=NoxgpHkBqbdrfX07MqXV`)
.auth(scenario.user.username, scenario.user.password)
.set('kbn-xsrf', 'true')
.expect(200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ export default ({ loadTestFile, getService }: FtrProviderContext): void => {
});

// Basic
loadTestFile(require.resolve('./find_rules'));
loadTestFile(require.resolve('./get_rules'));
});
};

0 comments on commit 5718037

Please sign in to comment.