mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-29 16:29:27 +08:00
Add timeout to the rollout status (#425)
* Added timeout to the rollout status and tests for it * Fixed integration test errors * Fix for blue green integration test * Probable fix for integration errors * No jobs run error fixed * Changed timeout to file level constant * Added parsing logic for timeout * Made tests more concise * implemented timeout validation check in an extracted utils mod * Changed function name to parseDuration * Removed timeout parameter from getResource --------- Co-authored-by: David Gamero <david340804@gmail.com> Co-authored-by: Suneha Bose <123775811+bosesuneha@users.noreply.github.com>
This commit is contained in:
@@ -49,4 +49,60 @@ describe('manifestStabilityUtils', () => {
|
||||
expect(checkRolloutStatusSpy).toHaveBeenCalled()
|
||||
expect(spy).toHaveReturned()
|
||||
})
|
||||
|
||||
it('should pass timeout to checkRolloutStatus when provided', async () => {
|
||||
const timeout = '300s'
|
||||
const checkRolloutStatusSpy = jest
|
||||
.spyOn(kc, 'checkRolloutStatus')
|
||||
.mockImplementation(() => {
|
||||
return new Promise<ExecOutput>((resolve, reject) => {
|
||||
resolve({
|
||||
exitCode: 0,
|
||||
stderr: '',
|
||||
stdout: ''
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
await manifestStabilityUtils.checkManifestStability(
|
||||
kc,
|
||||
resources,
|
||||
ResourceTypeManagedCluster,
|
||||
timeout
|
||||
)
|
||||
|
||||
expect(checkRolloutStatusSpy).toHaveBeenCalledWith(
|
||||
'deployment',
|
||||
'test',
|
||||
'default',
|
||||
timeout
|
||||
)
|
||||
})
|
||||
|
||||
it('should call checkRolloutStatus without timeout when not provided', async () => {
|
||||
const checkRolloutStatusSpy = jest
|
||||
.spyOn(kc, 'checkRolloutStatus')
|
||||
.mockImplementation(() => {
|
||||
return new Promise<ExecOutput>((resolve, reject) => {
|
||||
resolve({
|
||||
exitCode: 0,
|
||||
stderr: '',
|
||||
stdout: ''
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
await manifestStabilityUtils.checkManifestStability(
|
||||
kc,
|
||||
resources,
|
||||
ResourceTypeManagedCluster
|
||||
)
|
||||
|
||||
expect(checkRolloutStatusSpy).toHaveBeenCalledWith(
|
||||
'deployment',
|
||||
'test',
|
||||
'default',
|
||||
undefined
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user