This commit is contained in:
Ganeshrockz 2021-04-15 11:35:18 +05:30
Родитель a58ad23e7f
Коммит 2577009bcb
3 изменённых файлов: 23 добавлений и 2 удалений

Просмотреть файл

@ -294,6 +294,27 @@ test("run() - deploy - Manifests provided by both new line and comma as a delimi
await expect(action.run()).resolves.not.toThrow();
});
test("run() - deploy - Manifests provided by both new line and comma and semi-colon as a delimiter", async () => {
const kubectlVersion = 'v1.18.0'
coreMock.getInput = jest.fn().mockImplementation((name) => {
if (name == 'manifests') {
return "bg-smi.yml\nbg.yml,deployment.yml;bg.yml";
}
if (name == 'action') {
return 'deploy';
}
return kubectlVersion;
});
coreMock.setFailed = jest.fn();
toolCacheMock.find = jest.fn().mockReturnValue(undefined);
toolCacheMock.downloadTool = jest.fn().mockReturnValue('downloadpath');
toolCacheMock.cacheFile = jest.fn().mockReturnValue('cachepath');
fileUtility.chmodSync = jest.fn();
//Invoke and assert
await expect(action.run()).resolves.not.toThrow();
});
test("deployment - deploy() - Invokes with no manifestfiles", async () => {
const kubeCtl: jest.Mocked<Kubectl> = new Kubectl("") as any;

Просмотреть файл

@ -5,7 +5,7 @@ import * as core from '@actions/core';
export let namespace: string = core.getInput('namespace');
export const containers: string[] = core.getInput('images').split('\n');
export const imagePullSecrets: string[] = core.getInput('imagepullsecrets').split('\n').filter(secret => secret.trim().length > 0);
export const manifests = core.getInput('manifests').split(/[\n,]+/).filter(manifest => manifest.trim().length > 0);
export const manifests = core.getInput('manifests').split(/[\n,;]+/).filter(manifest => manifest.trim().length > 0);
export const canaryPercentage: string = core.getInput('percentage');
export const deploymentStrategy: string = core.getInput('strategy');
export const trafficSplitMethod: string = core.getInput('traffic-split-method');

Просмотреть файл

@ -59,7 +59,7 @@ export async function run() {
namespace = 'default';
}
let action = core.getInput('action');
let manifests = manifestsInput.split(/[\n,]+/).filter(manifest => manifest.trim().length > 0);
let manifests = manifestsInput.split(/[\n,;]+/).filter(manifest => manifest.trim().length > 0);
if (manifests.length > 0) {
manifests = manifests.map(manifest => {