-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Actions add proxy support #74289
Actions add proxy support #74289
Changes from 19 commits
499cbbd
229ae77
88ef76c
cf98dd3
ebb99a4
cbcbfc6
e2d8bf0
b8cbda1
e4debd0
4439096
9db7be1
4895991
42639a3
9039f11
d7a7254
2dacff0
bb9fcac
b043eeb
83be05c
f669e08
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 |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
import { TypeOf } from '@kbn/config-schema'; | ||
import { Logger } from '../../../../../../src/core/server'; | ||
|
||
import { | ||
ExternalIncidentServiceConfigurationSchema, | ||
|
@@ -122,7 +123,12 @@ export interface ExternalServiceApi { | |
|
||
export interface CreateExternalServiceBasicArgs { | ||
api: ExternalServiceApi; | ||
createExternalService: (credentials: ExternalServiceCredentials) => ExternalService; | ||
createExternalService: ( | ||
credentials: ExternalServiceCredentials, | ||
logger: Logger, | ||
proxySettings?: any | ||
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. Can 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. I've a got in this case |
||
) => ExternalService; | ||
logger: Logger; | ||
} | ||
|
||
export interface CreateExternalServiceArgs extends CreateExternalServiceBasicArgs { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -269,6 +269,7 @@ describe('execute()', () => { | |
"message": "a message to you", | ||
"subject": "the subject", | ||
}, | ||
"proxySettings": undefined, | ||
"routing": Object { | ||
"bcc": Array [ | ||
"[email protected]", | ||
|
@@ -326,6 +327,7 @@ describe('execute()', () => { | |
"message": "a message to you", | ||
"subject": "the subject", | ||
}, | ||
"proxySettings": undefined, | ||
"routing": Object { | ||
"bcc": Array [ | ||
"[email protected]", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,9 @@ import axios from 'axios'; | |
import { createExternalService } from './service'; | ||
import * as utils from '../lib/axios_utils'; | ||
import { ExternalService } from '../case/types'; | ||
import { Logger } from '../../../../../../src/core/server'; | ||
import { loggingSystemMock } from '../../../../../../src/core/server/mocks'; | ||
const logger = loggingSystemMock.create().get() as jest.Mocked<Logger>; | ||
|
||
jest.mock('axios'); | ||
jest.mock('../lib/axios_utils', () => { | ||
|
@@ -26,10 +29,13 @@ describe('Jira service', () => { | |
let service: ExternalService; | ||
|
||
beforeAll(() => { | ||
service = createExternalService({ | ||
config: { apiUrl: 'https://siem-kibana.atlassian.net', projectKey: 'CK' }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}); | ||
service = createExternalService( | ||
{ | ||
config: { apiUrl: 'https://siem-kibana.atlassian.net', projectKey: 'CK' }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}, | ||
logger | ||
); | ||
}); | ||
|
||
beforeEach(() => { | ||
|
@@ -39,37 +45,49 @@ describe('Jira service', () => { | |
describe('createExternalService', () => { | ||
test('throws without url', () => { | ||
expect(() => | ||
createExternalService({ | ||
config: { apiUrl: null, projectKey: 'CK' }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}) | ||
createExternalService( | ||
{ | ||
config: { apiUrl: null, projectKey: 'CK' }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}, | ||
logger | ||
) | ||
).toThrow(); | ||
}); | ||
|
||
test('throws without projectKey', () => { | ||
expect(() => | ||
createExternalService({ | ||
config: { apiUrl: 'test.com', projectKey: null }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}) | ||
createExternalService( | ||
{ | ||
config: { apiUrl: 'test.com', projectKey: null }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}, | ||
logger | ||
) | ||
).toThrow(); | ||
}); | ||
|
||
test('throws without username', () => { | ||
expect(() => | ||
createExternalService({ | ||
config: { apiUrl: 'test.com' }, | ||
secrets: { apiToken: '', email: '[email protected]' }, | ||
}) | ||
createExternalService( | ||
{ | ||
config: { apiUrl: 'test.com' }, | ||
secrets: { apiToken: '', email: '[email protected]' }, | ||
}, | ||
logger | ||
) | ||
).toThrow(); | ||
}); | ||
|
||
test('throws without password', () => { | ||
expect(() => | ||
createExternalService({ | ||
config: { apiUrl: 'test.com' }, | ||
secrets: { apiToken: '', email: undefined }, | ||
}) | ||
createExternalService( | ||
{ | ||
config: { apiUrl: 'test.com' }, | ||
secrets: { apiToken: '', email: undefined }, | ||
}, | ||
logger | ||
) | ||
).toThrow(); | ||
}); | ||
}); | ||
|
@@ -92,6 +110,7 @@ describe('Jira service', () => { | |
expect(requestMock).toHaveBeenCalledWith({ | ||
axios, | ||
url: 'https://siem-kibana.atlassian.net/rest/api/2/issue/1', | ||
logger, | ||
}); | ||
}); | ||
|
||
|
@@ -146,6 +165,7 @@ describe('Jira service', () => { | |
expect(requestMock).toHaveBeenCalledWith({ | ||
axios, | ||
url: 'https://siem-kibana.atlassian.net/rest/api/2/issue', | ||
logger, | ||
method: 'post', | ||
data: { | ||
fields: { | ||
|
@@ -210,6 +230,7 @@ describe('Jira service', () => { | |
|
||
expect(requestMock).toHaveBeenCalledWith({ | ||
axios, | ||
logger, | ||
method: 'put', | ||
url: 'https://siem-kibana.atlassian.net/rest/api/2/issue/1', | ||
data: { fields: { summary: 'title', description: 'desc' } }, | ||
|
@@ -272,6 +293,7 @@ describe('Jira service', () => { | |
|
||
expect(requestMock).toHaveBeenCalledWith({ | ||
axios, | ||
logger, | ||
method: 'post', | ||
url: 'https://siem-kibana.atlassian.net/rest/api/2/issue/1/comment', | ||
data: { body: 'comment' }, | ||
|
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.
seems slightly odd that the package names got resorted here, though it looks like they sorted CORRECTLY now, and weren't before. Like someone previously edited the file manually. It's just
@types/
packages anyway though, so not a big deal, and it looks fine to me.