Skip to content

Commit 8a41db8

Browse files
committed
fix(scf): update cls logical
1 parent 463ec2e commit 8a41db8

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

__tests__/scf.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,17 @@ describe('Scf', () => {
537537
},
538538
]);
539539
});
540+
test('[remove cls] update', async () => {
541+
await sleep(3000);
542+
inputs.cls = {
543+
logsetId: '',
544+
topicId: '',
545+
};
546+
outputs = await scf.deploy(inputs);
547+
548+
expect(outputs.ClsLogsetId).toBe('');
549+
expect(outputs.ClsTopicId).toBe('');
550+
});
540551
test('invoke', async () => {
541552
const res = await scf.invoke({
542553
namespace: inputs.namespace,
@@ -565,6 +576,7 @@ describe('Scf', () => {
565576
});
566577
test('[asyncRunEnable and traceEnable] create', async () => {
567578
await sleep(3000);
579+
delete inputs.cls;
568580
inputs.asyncRunEnable = true;
569581
inputs.traceEnable = true;
570582
outputs = await scf.deploy(inputs);

src/modules/scf/entities/scf.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,11 @@ export default class ScfEntity extends BaseEntity {
155155
Namespace: inputs.namespace || funcInfo.Namespace,
156156
MemorySize: inputs.memorySize || funcInfo.MemorySize,
157157
};
158-
if (!reqParams.ClsLogsetId) {
159-
reqParams.ClsLogsetId = '';
160-
reqParams.ClsTopicId = '';
161-
}
158+
// 由于业务变动,后端会默认创建cls来记录日志,如果需要删除 CLS 配置,用户需要手动配置为 ’‘
159+
// if (!reqParams.ClsLogsetId) {
160+
// reqParams.ClsLogsetId = '';
161+
// reqParams.ClsTopicId = '';
162+
// }
162163

163164
const reqInputs: Partial<typeof reqParams> = reqParams;
164165

src/modules/scf/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ export const formatInputs = (region: RegionType, inputs: ScfCreateFunctionInputs
7575
functionInputs.Description = inputs.description;
7676
}
7777
if (inputs.cls) {
78-
if (inputs.cls.logsetId) {
78+
if (inputs.cls.logsetId !== undefined) {
7979
functionInputs.ClsLogsetId = inputs.cls.logsetId;
8080
}
81-
if (inputs.cls.topicId) {
81+
if (inputs.cls.topicId !== undefined) {
8282
functionInputs.ClsTopicId = inputs.cls.topicId;
8383
}
8484
}

0 commit comments

Comments
 (0)