Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dsame committed Jul 12, 2023
1 parent d4fc988 commit 7eefc6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/windows-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- run: |
du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'
size=$(du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'|cut -f1 -d$'\t')
# make sure archive does not take lost of the space
# make sure archive does not take lot of space
if [ $size -gt 999 ];then
echo 'Size of installed on drive d: go is too big';
exit 1
Expand Down
9 changes: 7 additions & 2 deletions __tests__/windows-performance.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'fs';
import * as io from '@actions/io';
import {addExecutablesToCache, IGoVersionInfo} from '../src/installer';
import path from 'path';

describe('Windows performance workaround', () => {
let mkdirSpy: jest.SpyInstance;
Expand Down Expand Up @@ -52,10 +53,14 @@ describe('Windows performance workaround', () => {

process.env['RUNNER_TOOL_CACHE'] = '/faked-hostedtoolcache1';
const cacheDir1 = await addExecutablesToCache('/qzx', info, 'arch');
expect(cacheDir1).toBe('/faked-hostedtoolcache1/go/1.2.3/arch');
expect(cacheDir1).toBe(
path.join('/', 'faked-hostedtoolcache1', 'go', '1.2.3', 'arch')
);

process.env['RUNNER_TOOL_CACHE'] = '/faked-hostedtoolcache2';
const cacheDir2 = await addExecutablesToCache('/qzx', info, 'arch');
expect(cacheDir2).toBe('/faked-hostedtoolcache2/go/1.2.3/arch');
expect(cacheDir2).toBe(
path.join('/', 'faked-hostedtoolcache2', 'go', '1.2.3', 'arch')
);
});
});

0 comments on commit 7eefc6e

Please sign in to comment.