mirror of
https://github.com/opentofu/setup-opentofu.git
synced 2026-11-29 19:44:21 +01:00
feat: support .tool-versions (asdf format) in tofu_version_file (#131)
Signed-off-by: somaz <genius5711@gmail.com>
This commit is contained in:
1 parent
7f68c568ed
commit
37a417e5ae
4 files changed
+49
-6
No files matched your search
@@ -225,6 +225,34 @@ describe('setup-tofu', () => {
|
||||
|
||||
expect(fs.readFile).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should parse the opentofu version from a .tool-versions (asdf) file', async () => {
|
||||
jest.spyOn(fs, 'readFile');
|
||||
|
||||
const asdfVersion = '1.9.0';
|
||||
versionFileName = '.tool-versions';
|
||||
versionFile = join(tempDir, versionFileName);
|
||||
await fs.writeFile(versionFile, `nodejs 24.14.0\nopentofu ${asdfVersion}\nterraform 1.5.0\n`);
|
||||
|
||||
getInput.mockImplementation((name) => {
|
||||
if (name === 'tofu_version_file') {
|
||||
return versionFile;
|
||||
}
|
||||
if (name === 'tofu_version') {
|
||||
return fallbackVersion;
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
await setup();
|
||||
|
||||
expect(getRelease).toHaveBeenCalledWith(
|
||||
asdfVersion,
|
||||
process.env.GITHUB_TOKEN
|
||||
);
|
||||
|
||||
expect(fs.readFile).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('caching functionality', () => {
|
||||
|
||||
Reference in new issue
Block a user