Skip to content

Commit

Permalink
Add node modules and new code for release (#39)
Browse files Browse the repository at this point in the history
Co-authored-by: tbarnes94 <[email protected]>
  • Loading branch information
github-actions[bot] and tbarnes94 authored Jan 5, 2022
1 parent a10d84b commit 7ad2aa6
Show file tree
Hide file tree
Showing 7,655 changed files with 1,763,577 additions and 14 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,3 @@ ASALocalRun/

# MFractors (Xamarin productivity tool) working folder
.mfractor/
node_modules
8 changes: 4 additions & 4 deletions lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ function downloadKubectl(version) {
return __awaiter(this, void 0, void 0, function* () {
let cachedToolpath = toolCache.find(kubectlToolName, version);
let kubectlDownloadPath = '';
const arch = helpers_1.getKubectlArch();
const arch = (0, helpers_1.getKubectlArch)();
if (!cachedToolpath) {
try {
kubectlDownloadPath = yield toolCache.downloadTool(helpers_1.getkubectlDownloadURL(version, arch));
kubectlDownloadPath = yield toolCache.downloadTool((0, helpers_1.getkubectlDownloadURL)(version, arch));
}
catch (exception) {
if (exception instanceof toolCache.HTTPError && exception.httpStatusCode === 404) {
Expand All @@ -65,9 +65,9 @@ function downloadKubectl(version) {
throw new Error('DownloadKubectlFailed');
}
}
cachedToolpath = yield toolCache.cacheFile(kubectlDownloadPath, kubectlToolName + helpers_1.getExecutableExtension(), kubectlToolName, version);
cachedToolpath = yield toolCache.cacheFile(kubectlDownloadPath, kubectlToolName + (0, helpers_1.getExecutableExtension)(), kubectlToolName, version);
}
const kubectlPath = path.join(cachedToolpath, kubectlToolName + helpers_1.getExecutableExtension());
const kubectlPath = path.join(cachedToolpath, kubectlToolName + (0, helpers_1.getExecutableExtension)());
fs.chmodSync(kubectlPath, '777');
return kubectlPath;
});
Expand Down
12 changes: 6 additions & 6 deletions lib/run.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ const util = require("util");
describe('Testing all functions in run file.', () => {
test('getExecutableExtension() - return .exe when os is Windows', () => {
jest.spyOn(os, 'type').mockReturnValue('Windows_NT');
expect(helpers_1.getExecutableExtension()).toBe('.exe');
expect((0, helpers_1.getExecutableExtension)()).toBe('.exe');
expect(os.type).toBeCalled();
});
test('getExecutableExtension() - return empty string for non-windows OS', () => {
jest.spyOn(os, 'type').mockReturnValue('Darwin');
expect(helpers_1.getExecutableExtension()).toBe('');
expect((0, helpers_1.getExecutableExtension)()).toBe('');
expect(os.type).toBeCalled();
});
test.each([
Expand All @@ -34,7 +34,7 @@ describe('Testing all functions in run file.', () => {
['x64', 'amd64']
])("getKubectlArch() - return on %s os arch %s kubectl arch", (osArch, kubectlArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch);
expect(helpers_1.getKubectlArch()).toBe(kubectlArch);
expect((0, helpers_1.getKubectlArch)()).toBe(kubectlArch);
expect(os.arch).toBeCalled();
});
test.each([
Expand All @@ -44,7 +44,7 @@ describe('Testing all functions in run file.', () => {
])('getkubectlDownloadURL() - return the URL to download %s kubectl for Linux', (arch) => {
jest.spyOn(os, 'type').mockReturnValue('Linux');
const kubectlLinuxUrl = util.format('https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/linux/%s/kubectl', arch);
expect(helpers_1.getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlLinuxUrl);
expect((0, helpers_1.getkubectlDownloadURL)('v1.15.0', arch)).toBe(kubectlLinuxUrl);
expect(os.type).toBeCalled();
});
test.each([
Expand All @@ -54,7 +54,7 @@ describe('Testing all functions in run file.', () => {
])('getkubectlDownloadURL() - return the URL to download %s kubectl for Darwin', (arch) => {
jest.spyOn(os, 'type').mockReturnValue('Darwin');
const kubectlDarwinUrl = util.format('https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/darwin/%s/kubectl', arch);
expect(helpers_1.getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlDarwinUrl);
expect((0, helpers_1.getkubectlDownloadURL)('v1.15.0', arch)).toBe(kubectlDarwinUrl);
expect(os.type).toBeCalled();
});
test.each([
Expand All @@ -64,7 +64,7 @@ describe('Testing all functions in run file.', () => {
])('getkubectlDownloadURL() - return the URL to download %s kubectl for Windows', (arch) => {
jest.spyOn(os, 'type').mockReturnValue('Windows_NT');
const kubectlWindowsUrl = util.format('https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/windows/%s/kubectl.exe', arch);
expect(helpers_1.getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlWindowsUrl);
expect((0, helpers_1.getkubectlDownloadURL)('v1.15.0', arch)).toBe(kubectlWindowsUrl);
expect(os.type).toBeCalled();
});
test('getStableKubectlVersion() - download stable version file, read version and return it', () => __awaiter(void 0, void 0, void 0, function* () {
Expand Down
Loading

0 comments on commit 7ad2aa6

Please sign in to comment.