Skip to content

Commit 84d7a01

Browse files
千风SquatsTonight
authored andcommitted
fix some spelling error and upgrade fc-docker version
1 parent 6a73ad2 commit 84d7a01

5 files changed

Lines changed: 16 additions & 18 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
]
2525
},
2626
"fc-docker": {
27-
"version": "1.9.13",
27+
"version": "1.9.17",
2828
"registry_default": "registry.cn-beijing.aliyuncs.com",
2929
"registry_mirrors": [
3030
"registry.cn-beijing.aliyuncs.com",

src/lib/docker-opts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ async function resolveDockerRegistry() {
7070
return DOCKER_REGISTRY_CACHE;
7171
}
7272

73-
const IMAGE_VERSION = process.env.FC_DOCKER_VERSION || pkg['fc-docker'].version || '1.9.13';
73+
const IMAGE_VERSION = process.env.FC_DOCKER_VERSION || pkg['fc-docker'].version || '1.9.17';
7474

7575
async function resolveRuntimeToDockerImage(runtime, isBuild) {
7676
if (runtimeImageMap[runtime]) {

src/lib/docker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,14 +485,14 @@ async function generateDockerEnvs(baseDir, serviceName, serviceProps, functionNa
485485
'FC_ACCESS_KEY_ID': profile.accessKeyId,
486486
'FC_ACCESS_KEY_SECRET': profile.accessKeySecret,
487487
'FC_SECURITY_TOKEN': profile.securityToken,
488-
'FC_ACCOUND_ID': profile.accountId,
488+
'FC_ACCOUNT_ID': profile.accountId,
489489
'FC_REGION': profile.defaultRegion,
490490
'FC_FUNCTION_NAME': functionName,
491491
'FC_HANDLER': functionProps.Handler,
492492
'FC_MEMORY_SIZE': functionProps.MemorySize || 128,
493493
'FC_TIMEOUT': functionProps.Timeout || 3,
494494
'FC_INITIALIZER': functionProps.Initializer,
495-
'FC_INITIALIZATIONTIMEOUT': functionProps.InitializationTimeout || 3,
495+
'FC_INITIALIZATION_TIMEOUT': functionProps.InitializationTimeout || 3,
496496
'FC_SERVICE_NAME': serviceName,
497497
'FC_SERVICE_LOG_PROJECT': ((serviceProps || {}).LogConfig || {}).Project,
498498
'FC_SERVICE_LOG_STORE': ((serviceProps || {}).LogConfig || {}).Logstore

src/lib/local/http.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ function getFcReqHeaders(headers, reqeustId, envs) {
241241
fcHeaders['x-fc-function-name'] = headers['x-fc-function-name'] ? headers['x-fc-function-name'] : envs['FC_FUNCTION_NAME'] || 'fc-docker';
242242
fcHeaders['x-fc-function-memory'] = headers['x-fc-function-memory'] ? headers['x-fc-function-memory'] : envs['FC_MEMORY_SIZE'];
243243
fcHeaders['x-fc-function-timeout'] = headers['x-fc-function-timeout'] ? headers['x-fc-function-timeout'] : envs['FC_TIMEOUT'];
244-
fcHeaders['x-fc-initialization-timeout'] = headers['x-fc-initialization-timeout'] ? headers['x-fc-initialization-timeout'] : envs['FC_INITIALIZATIONTIMEOUT'];
244+
fcHeaders['x-fc-initialization-timeout'] = headers['x-fc-initialization-timeout'] ? headers['x-fc-initialization-timeout'] : envs['FC_INITIALIZATION_TIMEOUT'];
245245
fcHeaders['x-fc-function-initializer'] = headers['x-fc-function-initializer'] ? headers['x-fc-function-initializer'] : envs['FC_INITIALIZER'];
246246
fcHeaders['x-fc-function-handler'] = headers['x-fc-function-handler'] ? headers['x-fc-function-handler'] : envs['FC_HANDLER'];
247247
fcHeaders['x-fc-access-key-id'] = headers['x-fc-access-key-id'] ? headers['x-fc-access-key-id'] : envs['FC_ACCESS_KEY_ID'];
248248
fcHeaders['x-fc-access-key-secret'] = headers['x-fc-access-key-secret'] ? headers['x-fc-access-key-secret'] : envs['FC_ACCESS_KEY_SECRET'];
249249
fcHeaders['x-fc-security-token'] = headers['x-fc-security-token'] ? headers['x-fc-security-token'] : envs['FC_SECURITY_TOKEN'];
250250
fcHeaders['x-fc-region'] = headers['x-fc-region'] ? headers['x-fc-region'] : envs['FC_REGION'];
251-
fcHeaders['x-fc-account-id'] = headers['x-fc-account-id'] ? headers['x-fc-account-id'] : envs['FC_ACCOUND_ID'];
251+
fcHeaders['x-fc-account-id'] = headers['x-fc-account-id'] ? headers['x-fc-account-id'] : envs['FC_ACCOUNT_ID'];
252252
fcHeaders['x-fc-service-name'] = headers['x-fc-service-name'] ? headers['x-fc-service-name'] : envs['FC_SERVICE_NAME'];
253253
fcHeaders['x-fc-service-logproject'] = headers['x-fc-service-logproject'] ? headers['x-fc-service-logproject'] : envs['FC_SERVICE_LOG_PROJECT'];
254254
fcHeaders['x-fc-service-logstore'] = headers['x-fc-service-logstore'] ? headers['x-fc-service-logstore'] : envs['FC_SERVICE_LOG_STORE'];

test/local/http-invoke.test.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const HttpInvoke = require('../../lib/local/http-invoke');
4-
4+
const { ensureTmpDir } = require('../../lib/utils/path');
55
const sinon = require('sinon');
66
const assert = sinon.assert;
77

@@ -18,7 +18,7 @@ const httpx = require('httpx');
1818
const FC = require('@alicloud/fc2');
1919

2020
const { serviceName, serviceRes, functionName, functionRes,
21-
httptriggerServiceRes, httpTriggerFunctionRes
21+
httpTriggerServiceRes, httpTriggerFunctionRes
2222
} = require('./mock-data');
2323

2424
const { setProcess } = require('../test-utils');
@@ -106,8 +106,9 @@ describe('test http response', async () => {
106106
let server;
107107
let restoreProcess;
108108
let httpInvoke;
109-
109+
let tmpDir;
110110
beforeEach(async () => {
111+
tmpDir = await ensureTmpDir(null, projectDir, serviceName, functionName);
111112

112113
await fs.mkdirp(projectDir);
113114

@@ -147,18 +148,15 @@ def handler(environ, start_response):
147148
const endpointPrefix = `/2016-08-15/proxy/${serviceName}/${functionName}`;
148149
const endpoint = `${endpointPrefix}*`;
149150

150-
httpInvoke = new HttpInvoke(serviceName, httptriggerServiceRes,
151-
functionName, httpTriggerFunctionRes, null, null, projectDir, 'ANONYMOUS', endpointPrefix);
152-
151+
httpInvoke = new HttpInvoke(serviceName, httpTriggerServiceRes,
152+
functionName, httpTriggerFunctionRes, null, null, projectDir, tmpDir, 'ANONYMOUS', endpointPrefix);
153153
app.get(endpoint, async (req, res) => {
154154
await httpInvoke.invoke(req, res);
155155
});
156-
157156
const resp = await httpx.request(`http://localhost:${serverPort}${endpointPrefix}`, {
158157
method: 'GET',
159158
timeout: '3000'
160159
});
161-
162160
const body = await httpx.read(resp, 'utf8');
163161

164162
expect(body).to.contain('Hello world!');
@@ -177,8 +175,8 @@ def handler(environ, start_response):
177175
const endpointPrefix = `/2016-08-15/proxy/${serviceName}/${functionName}`;
178176
const endpoint = `${endpointPrefix}*`;
179177

180-
httpInvoke = new HttpInvoke(serviceName, httptriggerServiceRes,
181-
functionName, httpTriggerFunctionRes, null, null, projectDir, 'FUNCTION', endpointPrefix);
178+
httpInvoke = new HttpInvoke(serviceName, httpTriggerServiceRes,
179+
functionName, httpTriggerFunctionRes, null, null, projectDir, tmpDir, 'FUNCTION', endpointPrefix);
182180

183181
app.get(endpoint, async (req, res) => {
184182
await httpInvoke.invoke(req, res);
@@ -207,8 +205,8 @@ def handler(environ, start_response):
207205
const endpointPrefix = `/2016-08-15/proxy/${serviceName}/${functionName}`;
208206
const endpoint = `${endpointPrefix}*`;
209207

210-
const httpInvoke = new HttpInvoke(serviceName, httptriggerServiceRes,
211-
functionName, httpTriggerFunctionRes, null, null, projectDir, 'FUNCTION', endpointPrefix);
208+
const httpInvoke = new HttpInvoke(serviceName, httpTriggerServiceRes,
209+
functionName, httpTriggerFunctionRes, null, null, projectDir, tmpDir, 'FUNCTION', endpointPrefix);
212210

213211
app.get(endpoint, async (req, res) => {
214212
await httpInvoke.invoke(req, res);

0 commit comments

Comments
 (0)