Skip to content

Commit e9be3d3

Browse files
committed
Always call mpm install even if MATLAB is in toolcache
1 parent b491502 commit e9be3d3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/install.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ export async function install(platform: string, architecture: string, release: s
3838
matlabArch = "x64";
3939
}
4040

41-
let [destination, alreadyExists]: [string, boolean] = await matlab.getToolcacheDir(platform, releaseInfo);
41+
let [destination]: [string, boolean] = await matlab.getToolcacheDir(platform, releaseInfo);
4242
let cacheHit = false;
4343

4444
if (useCache) {
4545
const supportFilesDir = matlab.getSupportPackagesPath(platform, releaseInfo.name);
4646
cacheHit = await cache.restoreMATLAB(releaseInfo, platform, matlabArch, products, destination, supportFilesDir);
4747
}
4848

49-
if (!alreadyExists && !cacheHit) {
49+
if (!cacheHit) {
5050
const mpmPath: string = await mpm.setup(platform, matlabArch);
5151
await mpm.install(mpmPath, releaseInfo, products, destination);
5252
core.saveState(State.InstallSuccessful, 'true');

src/install.unit.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ describe("install procedure", () => {
7979
expect(setOutputMock).toHaveBeenCalledTimes(1);
8080
});
8181

82-
it("NoOp on existing install", async () => {
82+
it("re-calls MPM install even if MATLAB already exists in toolcache", async () => {
8383
matlabGetToolcacheDirMock.mockResolvedValue(["/opt/hostedtoolcache/MATLAB/9.13.0/x64", true]);
8484
await expect(doInstall()).resolves.toBeUndefined();
85-
expect(mpmInstallMock).toHaveBeenCalledTimes(0);
86-
expect(saveStateMock).toHaveBeenCalledTimes(0);
85+
expect(mpmInstallMock).toHaveBeenCalledTimes(1);
86+
expect(saveStateMock).toHaveBeenCalledTimes(1);
8787
expect(addPathMock).toHaveBeenCalledTimes(1);
8888
expect(setOutputMock).toHaveBeenCalledTimes(1);
8989
});

0 commit comments

Comments
 (0)