Skip to content

Commit

Permalink
test legacy for space_1_all and restricted users
Browse files Browse the repository at this point in the history
  • Loading branch information
gmmorris committed Sep 4, 2020
1 parent 6f7f628 commit b226e32
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ export default function alertingTests({ loadTestFile }: FtrProviderContext) {

// note that this test will destroy existing spaces
loadTestFile(require.resolve('./rbac_legacy'));
// loadTestFile(require.resolve('./CREATE_DATA'));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export default function alertTests({ getService }: FtrProviderContext) {
const MIGRATED_ACTION_ID = '17f38826-5a8d-4a76-975a-b496e7fffe0b';
const MIGRATED_ALERT_ID: Record<string, string> = {
space_1_all_alerts_none_actions: '6ee9630a-a20e-44af-9465-217a3717d2ab',
// space_1_all_with_restricted_fixture: '5cc59319-74ee-4edc-8646-a79ea91067cd',
// space_1_all: 'd41a6abb-b93b-46df-a80a-926221ea847c',
space_1_all_with_restricted_fixture: '5cc59319-74ee-4edc-8646-a79ea91067cd',
space_1_all: 'd41a6abb-b93b-46df-a80a-926221ea847c',
superuser: 'b384be60-ec53-4b26-857e-0253ee55b277',
};

Expand Down Expand Up @@ -76,11 +76,11 @@ export default function alertTests({ getService }: FtrProviderContext) {
case 'global_read at space1':
// These cases are not relevant as we're testing the migration of alerts which
// were valid pre 7.10.0 and which become invalid after the introduction of RBAC in 7.10.0
// these cases were invalid pre 7.10.0 and remain invalid post 7.10.0
break;
case 'space_1_all at space1':
case 'space_1_all_with_restricted_fixture at space1':
break;
case 'superuser at space1':
case 'space_1_all_with_restricted_fixture at space1':
await ensureLegacyAlertHasBeenMigrated(migratedAlertId);

await updateMigratedAlertToUseApiKeyOfCurrentUser(migratedAlertId);
Expand Down
188 changes: 188 additions & 0 deletions x-pack/test/functional/es_archives/alerts_legacy/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,192 @@
"updated_at": "2020-09-04T11:51:04.273Z"
}
}
}

{
"type": "doc",
"value": {
"id": "space1:alert:5cc59319-74ee-4edc-8646-a79ea91067cd",
"index": ".kibana_1",
"source": {
"alert": {
"actions": [
{
"actionRef": "action_0",
"actionTypeId": "test.index-record",
"group": "default",
"params": {
"index": ".kibana-alerting-test-data",
"message": "alertId: {{alertId}},\nalertName: {{alertName}},\nspaceId: {{spaceId}},\ntags: {{tags}},\nalertInstanceId: {{alertInstanceId}},\ninstanceContextValue: {{context.instanceContextValue}},\ninstanceStateValue: {{state.instanceStateValue}}",
"reference": "alert:migrated-to-7.10:space_1_all_with_restricted_fixture"
}
}
],
"alertTypeId": "test.always-firing",
"apiKey": "OFpEg7T+jq0nVoGkqHEN5W0fgcEu4LmCXCz6F5EzQ8mgxr2+270/nqv2+zSTnkef7rK2Xz2MDmQsdrRrsAFb5ItFb5YnR/zfqbq0+QBlvgqChKORE1+ggI1oQsYnjDtPWOqMwbUUNGYQXdyUZVdRqeeoYq847NgSo5UBoCJgEZ9ah1gzPA6XYvzbBtJdZ+QgCjfuXsrBSlImhQ==",
"apiKeyOwner": "superuser",
"consumer": "alertsFixture",
"createdAt": "2020-09-04T11:51:02.571Z",
"createdBy": "superuser",
"enabled": true,
"muteAll": false,
"mutedInstanceIds": [
],
"name": "abc",
"params": {
"index": ".kibana-alerting-test-data",
"reference": "alert:migrated-to-7.10:space_1_all_with_restricted_fixture"
},
"schedule": {
"interval": "2s"
},
"scheduledTaskId": "e8885f00-eea4-11ea-a285-352ee3aecffa",
"tags": [
"tag-A",
"tag-B"
],
"throttle": "2s",
"updatedBy": "superuser"
},
"migrationVersion": {
"alert": "7.9.0"
},
"namespace": "space1",
"references": [
{
"id": "17f38826-5a8d-4a76-975a-b496e7fffe0b",
"name": "action_0",
"type": "action"
}
],
"type": "alert",
"updated_at": "2020-09-04T11:51:03.175Z"
}
}
}

{
"type": "doc",
"value": {
"id": "task:e8885f00-eea4-11ea-a285-352ee3aecffa",
"index": ".kibana_task_manager_1",
"source": {
"migrationVersion": {
"task": "7.6.0"
},
"references": [
],
"task": {
"attempts": 1,
"ownerId": "kibana:5b2de169-2785-441b-ae8c-186a1936b17d",
"params": "{\"alertId\":\"5cc59319-74ee-4edc-8646-a79ea91067cd\",\"spaceId\":\"space1\"}",
"retryAt": "2020-09-04T12:01:05.793Z",
"runAt": "2020-09-04T11:51:03.152Z",
"scheduledAt": "2020-09-04T11:51:03.152Z",
"scope": [
"alerting"
],
"startedAt": "2020-09-04T11:51:05.793Z",
"state": "{\"previousStartedAt\":null,\"alertTypeState\":{},\"alertInstances\":{}}",
"status": "running",
"taskType": "alerting:test.always-firing"
},
"type": "task",
"updated_at": "2020-09-04T11:51:05.794Z"
}
}
}

{
"type": "doc",
"value": {
"id": "space1:alert:d41a6abb-b93b-46df-a80a-926221ea847c",
"index": ".kibana_1",
"source": {
"alert": {
"actions": [
{
"actionRef": "action_0",
"actionTypeId": "test.index-record",
"group": "default",
"params": {
"index": ".kibana-alerting-test-data",
"message": "alertId: {{alertId}},\nalertName: {{alertName}},\nspaceId: {{spaceId}},\ntags: {{tags}},\nalertInstanceId: {{alertInstanceId}},\ninstanceContextValue: {{context.instanceContextValue}},\ninstanceStateValue: {{state.instanceStateValue}}",
"reference": "alert:migrated-to-7.10:space_1_all"
}
}
],
"alertTypeId": "test.always-firing",
"apiKey": "5qbDONVFRacd8IukMksh11NZ8OFxSN31sJRgIdRw4GHME2qKqyqczHz/CDANEjKF78M98yc5xSr8vNnco2PDOHTD7YfMdnlrl1/lOdIkJ/IM8YxGBCLZfk5hRx/dD3X84ZtSEZ2hYWjAemFKtD5GpTWtczhkx9jRgUMbPgBzrhyEmDJoHMQQSOEpIJKmQpAcpHGsE5/+SVIcGQ==",
"apiKeyOwner": "superuser",
"consumer": "alertsFixture",
"createdAt": "2020-09-04T11:50:58.533Z",
"createdBy": "superuser",
"enabled": true,
"muteAll": false,
"mutedInstanceIds": [
],
"name": "abc",
"params": {
"index": ".kibana-alerting-test-data",
"reference": "alert:migrated-to-7.10:space_1_all"
},
"schedule": {
"interval": "2s"
},
"scheduledTaskId": "e616c2c0-eea4-11ea-a285-352ee3aecffa",
"tags": [
"tag-A",
"tag-B"
],
"throttle": "2s",
"updatedBy": "superuser"
},
"migrationVersion": {
"alert": "7.9.0"
},
"namespace": "space1",
"references": [
{
"id": "17f38826-5a8d-4a76-975a-b496e7fffe0b",
"name": "action_0",
"type": "action"
}
],
"type": "alert",
"updated_at": "2020-09-04T11:50:59.083Z"
}
}
}

{
"type": "doc",
"value": {
"id": "task:e616c2c0-eea4-11ea-a285-352ee3aecffa",
"index": ".kibana_task_manager_1",
"source": {
"migrationVersion": {
"task": "7.6.0"
},
"references": [
],
"task": {
"attempts": 1,
"ownerId": "kibana:5b2de169-2785-441b-ae8c-186a1936b17d",
"params": "{\"alertId\":\"d41a6abb-b93b-46df-a80a-926221ea847c\",\"spaceId\":\"space1\"}",
"retryAt": "2020-09-04T12:01:05.793Z",
"runAt": "2020-09-04T11:51:04.804Z",
"scheduledAt": "2020-09-04T11:50:59.052Z",
"scope": [
"alerting"
],
"startedAt": "2020-09-04T11:51:05.793Z",
"state": "{\"previousStartedAt\":null,\"alertTypeState\":{},\"alertInstances\":{}}",
"status": "idle",
"taskType": "alerting:test.always-firing"
},
"type": "task",
"updated_at": "2020-09-04T11:51:05.794Z"
}
}
}

0 comments on commit b226e32

Please sign in to comment.