Added L0 tests. (#15)
* Added L0 tests. * Added tests for run function.
This commit is contained in:
10
src/run.ts
10
src/run.ts
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user