-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: store code package to oss for large size of code package (#9)
#Context - store code package to oss for large size of code package - create bucket resource when needed - upload zip code to bucket - assign bucket link to fc code Refers #5 --------- Signed-off-by: seven <[email protected]>
- Loading branch information
Showing
11 changed files
with
7,722 additions
and
4,432 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const CODE_ZIP_SIZE_LIMIT = 15 * 1024 * 1024; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as ossDeployment from '@alicloud/ros-cdk-ossdeployment'; | ||
import { getFileSource } from '../../src/common'; | ||
import fs from 'node:fs'; | ||
|
||
jest.mock('@alicloud/ros-cdk-ossdeployment'); | ||
|
||
const fcName = 'testFunction'; | ||
const location = 'tests/fixtures/artifacts/artifact.zip'; | ||
|
||
describe('getFileSource', () => { | ||
it('should return the correct ossDeployment source', () => { | ||
getFileSource(fcName, location); | ||
expect(ossDeployment.Source.asset).toHaveBeenCalledWith( | ||
`${process.cwd()}/${location}`, | ||
{}, | ||
`${fcName}/50861cd99a3a678356030f5f189300af.zip`, | ||
); | ||
}); | ||
|
||
it('should throw an error if the path is a directory', () => { | ||
jest.spyOn(fs, 'lstatSync').mockReturnValue({ isDirectory: () => true } as fs.Stats); | ||
|
||
expect(() => getFileSource(fcName, location)).toThrow( | ||
'The provided path is a directory, not a file.', | ||
); | ||
}); | ||
}); |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.