This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added timeout for long running landkid builds. (#202)
* Added timeout to fail long running landkid builds using LAND_BUILD_TIMEOUT_TIME * Triggerd BB API to retrieve land build status * Added tests * Fix compilation issue caused by adding root express mock Co-authored-by: Grace <[email protected]> Co-authored-by: Michael Blaszczyk <[email protected]>
- Loading branch information
1 parent
9eab9b3
commit c0e3eab
Showing
8 changed files
with
221 additions
and
1 deletion.
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,37 @@ | ||
import axios from 'axios'; | ||
import { BitbucketPipelinesAPI } from '../BitbucketPipelinesAPI'; | ||
import { bitbucketAuthenticator } from '../BitbucketAuthenticator'; | ||
|
||
jest.mock('axios'); | ||
const mockedAxios = axios as unknown as jest.Mocked<typeof axios>; | ||
|
||
const bitbucketPipelineAPI = new BitbucketPipelinesAPI({ | ||
repoName: 'repo', | ||
repoOwner: 'owner', | ||
}); | ||
|
||
describe('BitbucketPipelinesAPI', () => { | ||
beforeEach(() => { | ||
jest.resetAllMocks(); | ||
jest.spyOn(bitbucketAuthenticator, 'getAuthConfig').mockResolvedValue({}); | ||
}); | ||
|
||
test(`getLandBuild > should return land build data`, async () => { | ||
const response = { | ||
data: { | ||
state: { | ||
result: { | ||
name: 'FAILED', | ||
}, | ||
}, | ||
}, | ||
}; | ||
mockedAxios.get.mockResolvedValue(response); | ||
|
||
expect(await bitbucketPipelineAPI.getLandBuild(123)).toBe(response.data); | ||
expect(mockedAxios.get).toBeCalledWith( | ||
'https://api.bitbucket.org/2.0/repositories/owner/repo/pipelines/123', | ||
{}, | ||
); | ||
}); | ||
}); |
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