mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-25 22:29:26 +08:00
v5.0.1 Release with Fleet Types (#358)
* extract resource type * fleet details * new release with fleet * format * type params * format * promote input * format * fleet type * format pls
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import * as manifestStabilityUtils from './manifestStabilityUtils'
|
||||
import {Kubectl} from '../types/kubectl'
|
||||
import {ResourceTypeFleet, ResourceTypeManagedCluster} from '../actions/deploy'
|
||||
import {ExecOutput} from '@actions/exec'
|
||||
import {exitCode, stdout} from 'process'
|
||||
|
||||
describe('manifestStabilityUtils', () => {
|
||||
const kc = new Kubectl('')
|
||||
@@ -10,18 +13,40 @@ describe('manifestStabilityUtils', () => {
|
||||
namespace: 'default'
|
||||
}
|
||||
]
|
||||
const resourceType = 'microsoft.containerservice/fleets'
|
||||
|
||||
it('should return immediately if the resource type is microsoft.containerservice/fleets', async () => {
|
||||
it('should return immediately if the resource type is fleet', async () => {
|
||||
const spy = jest.spyOn(manifestStabilityUtils, 'checkManifestStability')
|
||||
const checkRolloutStatusSpy = jest.spyOn(kc, 'checkRolloutStatus')
|
||||
await manifestStabilityUtils.checkManifestStability(
|
||||
kc,
|
||||
resources,
|
||||
resourceType
|
||||
ResourceTypeFleet
|
||||
)
|
||||
|
||||
expect(checkRolloutStatusSpy).not.toHaveBeenCalled()
|
||||
expect(spy).toHaveReturned()
|
||||
})
|
||||
|
||||
it('should run fully if the resource type is managedCluster', async () => {
|
||||
const spy = jest.spyOn(manifestStabilityUtils, 'checkManifestStability')
|
||||
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).toHaveBeenCalled()
|
||||
expect(spy).toHaveReturned()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,6 +3,7 @@ import * as KubernetesConstants from '../types/kubernetesTypes'
|
||||
import {Kubectl, Resource} from '../types/kubectl'
|
||||
import {checkForErrors} from './kubectlUtils'
|
||||
import {sleep} from './timeUtils'
|
||||
import {ClusterType, ResourceTypeFleet} from '../actions/deploy'
|
||||
|
||||
const IS_SILENT = false
|
||||
const POD = 'pod'
|
||||
@@ -10,13 +11,11 @@ const POD = 'pod'
|
||||
export async function checkManifestStability(
|
||||
kubectl: Kubectl,
|
||||
resources: Resource[],
|
||||
resourceType: string
|
||||
clusterTyper: ClusterType
|
||||
): Promise<void> {
|
||||
// Skip if resource type is microsoft.containerservice/fleets
|
||||
if (resourceType === 'microsoft.containerservice/fleets') {
|
||||
core.info(
|
||||
'Skipping checkManifestStability for microsoft.containerservice/fleets'
|
||||
)
|
||||
if (clusterTyper === ResourceTypeFleet) {
|
||||
core.info(`Skipping checkManifestStability for ${ResourceTypeFleet}`)
|
||||
return
|
||||
}
|
||||
let rolloutStatusHasErrors = false
|
||||
|
||||
Reference in New Issue
Block a user