Added L0 tests. (#15)

* Added L0 tests.

* Added tests for run function.
This commit is contained in:
Sundar 2021-03-25 18:56:24 +05:30 committed by GitHub
parent 2f03546c39
commit 2fd2ffa506
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 156 additions and 68 deletions

View file

@ -10,14 +10,14 @@ const kubectlToolName = 'kubectl';
const stableKubectlVersion = 'v1.15.0';
const stableVersionUrl = 'https://storage.googleapis.com/kubernetes-release/release/stable.txt';
function getExecutableExtension(): string {
export function getExecutableExtension(): string {
if (os.type().match(/^Win/)) {
return '.exe';
}
return '';
}
function getkubectlDownloadURL(version: string): string {
export function getkubectlDownloadURL(version: string): string {
switch (os.type()) {
case 'Linux':
return util.format('https://storage.googleapis.com/kubernetes-release/release/%s/bin/linux/amd64/kubectl', version);
@ -32,7 +32,7 @@ function getkubectlDownloadURL(version: string): string {
}
}
async function getStableKubectlVersion(): Promise<string> {
export async function getStableKubectlVersion(): Promise<string> {
return toolCache.downloadTool(stableVersionUrl).then((downloadPath) => {
let version = fs.readFileSync(downloadPath, 'utf8').toString().trim();
if (!version) {
@ -46,7 +46,7 @@ async function getStableKubectlVersion(): Promise<string> {
});
}
async function downloadKubectl(version: string): Promise<string> {
export async function downloadKubectl(version: string): Promise<string> {
let cachedToolpath = toolCache.find(kubectlToolName, version);
let kubectlDownloadPath = '';
if (!cachedToolpath) {
@ -77,4 +77,4 @@ export async function run() {
core.setOutput('kubectl-path', cachedPath);
}
run().catch(core.setFailed);
run().catch(core.setFailed);