-
Notifications
You must be signed in to change notification settings - Fork 1
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
[RORDEV-1257] refactoring #11
base: master
Are you sure you want to change the base?
Changes from all commits
9e1a957
1d194cf
4e24b13
2337a39
dc66a7c
864f43e
0b5e651
93203b7
1a1f877
d783cc3
25cae40
bc98106
01299f7
beb972a
9022ffd
79ef7e0
35d421b
16e652e
b15373d
ec1fa1c
85a373b
448fadc
7c0512c
ebc5869
0945c0e
662e6ea
37d248b
4fe0ec5
1e540ca
1055c0e
c696f94
6a12fef
c28b5f2
faceedd
50d28ae
dcbc776
547174a
6298845
301e29c
a54ca87
4352ed4
8422281
57a5e40
0b47186
e78fd88
b71182f
d4dc8b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
.DS_Store | ||
elk-ror/elk-ror.log | ||
**/.DS_Store | ||
.idea | ||
environments/**/*.log | ||
environments/**/*.zip | ||
environments/**/plugins | ||
e2e-tests/node_modules | ||
plugins/* | ||
results/* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,59 @@ | ||
import * as semver from 'semver'; | ||
import { getKibanaVersion, userCredentials } from '../support/helpers'; | ||
import { kbnApiAdvancedClient } from '../support/helpers/KbnApiAdvancedClient'; | ||
import { rorApiClient } from '../support/helpers/RorApiClient'; | ||
|
||
describe('Direct kibana request', () => { | ||
const user = 'user1:dev'; | ||
const user1 = 'user1:dev'; | ||
const admin = 'admin:dev'; | ||
|
||
afterEach(() => { | ||
const clearDirectKibanaRequestState = () => { | ||
kbnApiAdvancedClient.deleteSavedObjects(user); | ||
if (semver.gte(getKibanaVersion(), '8.0.0')) { | ||
kbnApiAdvancedClient.deleteDataViews(user); | ||
} | ||
}; | ||
beforeEach(() => { | ||
clearDirectKibanaRequestState(); | ||
rorApiClient.configureRorIndexMainSettings('defaultSettings.yaml'); | ||
}); | ||
|
||
afterEach(() => { | ||
clearDirectKibanaRequestState(); | ||
rorApiClient.configureRorIndexMainSettings('defaultSettings.yaml'); | ||
}); | ||
|
||
it('should check direct kibana request', () => { | ||
const verifySavedObjects = () => { | ||
kbnApiAdvancedClient.deleteSavedObjects(user); | ||
kbnApiAdvancedClient.deleteSavedObjects(user1); | ||
|
||
cy.log('Import saved objects for user1'); | ||
cy.kbnImport({ | ||
endpoint: "api/saved_objects/_import?overwrite=true", | ||
credentials: user, | ||
filename: 'cypress/fixtures/file.ndjson' | ||
endpoint: 'api/saved_objects/_import?overwrite=true', | ||
credentials: user1, | ||
fixtureFilename: 'file.ndjson' | ||
}); | ||
|
||
cy.log('Get imported saved objects for user1 Administrators group'); | ||
kbnApiAdvancedClient.getSavedObjects(user).then(result => { | ||
kbnApiAdvancedClient.getSavedObjects(user1).then(result => { | ||
expect(result.saved_objects[0].id).equal('my-pattern'); | ||
expect(result.saved_objects[1].id).equal('my-dashboard'); | ||
}) | ||
expect(result.saved_objects).to.have.length(2); | ||
}); | ||
|
||
cy.log('Get imported saved objects for admin Administrators group'); | ||
kbnApiAdvancedClient | ||
.getSavedObjects(userCredentials) | ||
.then(result => { | ||
expect(result.saved_objects[0].id).equal('my-pattern'); | ||
expect(result.saved_objects[1].id).equal('my-dashboard'); | ||
expect(result.saved_objects).to.have.length(2); | ||
}); | ||
kbnApiAdvancedClient.getSavedObjects(admin).then(result => { | ||
expect(result.saved_objects[0].id).equal('my-pattern'); | ||
expect(result.saved_objects[1].id).equal('my-dashboard'); | ||
expect(result.saved_objects).to.have.length(2); | ||
}); | ||
|
||
cy.log('Get imported saved objects for user1 infosec group'); | ||
kbnApiAdvancedClient.getSavedObjects(user, "infosec_group") | ||
.then(result => { | ||
const actual = result.saved_objects.some( | ||
saved_object => saved_object.id === 'my-pattern' || saved_object.id === 'my-dashboard' | ||
); | ||
// eslint-disable-next-line no-unused-expressions | ||
expect(actual).to.be.false; | ||
}); | ||
kbnApiAdvancedClient.getSavedObjects(user1, 'infosec_group').then(result => { | ||
const actual = result.saved_objects.some( | ||
saved_object => saved_object.id === 'my-pattern' || saved_object.id === 'my-dashboard' | ||
); | ||
// eslint-disable-next-line no-unused-expressions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like this es lint disable is redundant |
||
expect(actual).to.be.false; | ||
}); | ||
}; | ||
|
||
const verifyDataViews = () => { | ||
kbnApiAdvancedClient.deleteDataViews(user); | ||
kbnApiAdvancedClient.deleteDataViews(user1); | ||
cy.log('Create data_views for user1 Administrators group'); | ||
kbnApiAdvancedClient.createDataView( | ||
{ | ||
|
@@ -64,22 +63,30 @@ describe('Direct kibana request', () => { | |
name: 'My Logstash Data View' | ||
} | ||
}, | ||
user | ||
user1 | ||
); | ||
|
||
cy.log('get all data_views for user1 infosec group'); | ||
kbnApiAdvancedClient | ||
.getDataViews(userCredentials, "infosec_group") | ||
.then(result => { | ||
const actual = result.data_view.some(saved_object => saved_object.id === 'logstash'); | ||
// eslint-disable-next-line no-unused-expressions | ||
expect(actual).to.be.false; | ||
}); | ||
kbnApiAdvancedClient.getDataViews(userCredentials, 'infosec_group').then(result => { | ||
const actual = result.data_view.some(saved_object => saved_object.id === 'logstash'); | ||
|
||
// eslint-disable-next-line no-unused-expressions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like this es lint disable is redundant |
||
expect(actual).to.be.false; | ||
}); | ||
}; | ||
|
||
verifySavedObjects(); | ||
if (semver.gte(getKibanaVersion(), '8.0.0')) { | ||
verifyDataViews(); | ||
} | ||
}); | ||
|
||
const clearDirectKibanaRequestState = () => { | ||
kbnApiAdvancedClient.deleteSavedObjects(user1); | ||
kbnApiAdvancedClient.deleteSavedObjects(admin); | ||
if (semver.gte(getKibanaVersion(), '8.0.0')) { | ||
kbnApiAdvancedClient.deleteDataViews(user1); | ||
kbnApiAdvancedClient.deleteDataViews(admin); | ||
} | ||
}; | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,11 @@ import { Login } from '../support/page-objects/Login'; | |
import { Loader } from '../support/page-objects/Loader'; | ||
import { RorMenu } from '../support/page-objects/RorMenu'; | ||
import { Discover } from '../support/page-objects/Discover'; | ||
import defaultSettingsData from '../fixtures/defaultSettings.json'; | ||
import reportingSettingsData from '../fixtures/reportingSettings.json'; | ||
import { Settings } from '../support/page-objects/Settings'; | ||
|
||
describe('Reporting index', () => { | ||
describe.skip('Reporting index', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it intentionally skipped? |
||
beforeEach(() => { | ||
Settings.setSettingsData(reportingSettingsData); | ||
Settings.setSettingsData('reportingSettings.yaml'); | ||
cy.visit(Cypress.config().baseUrl); | ||
cy.on('url:changed', () => { | ||
sessionStorage.setItem('ror:ignoreTrialInfo', 'true'); | ||
|
@@ -19,7 +17,7 @@ describe('Reporting index', () => { | |
}); | ||
|
||
afterEach(() => { | ||
Settings.setSettingsData(defaultSettingsData); | ||
Settings.setSettingsData('defaultSettings.yaml'); | ||
}); | ||
|
||
it('should correctly match index pattern when audit index_template contains .reporting', () => { | ||
|
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.
What is the flow after the new version release for Kibana 7.x or 8.x? Should we upgrade it manually?