Skip to content

Instantly share code, notes, and snippets.

@joliss
Created July 27, 2020 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joliss/6d561cffa319f6960cb7c7b41e7b2ca6 to your computer and use it in GitHub Desktop.
Save joliss/6d561cffa319f6960cb7c7b41e7b2ca6 to your computer and use it in GitHub Desktop.
> @architect/sandbox@1.13.0 test /home/ubuntu/src/architect-sandbox
> npm run lint && npm run test:integration && npm run coverage
> @architect/sandbox@1.13.0 lint /home/ubuntu/src/architect-sandbox
> eslint . --fix
> @architect/sandbox@1.13.0 test:integration /home/ubuntu/src/architect-sandbox
> cross-env PORT=6666 tape 'test/integration/**/*-test.js' | tap-spec
db.start
✔ got db
[?25l
✔ Got Dynamo client
[?25l
✔ @tables created in local database
can list tables
✔ got tables
{
TableNames: [
'arc-sessions',
'mockapp-production-accounts',
'mockapp-production-arc-sessions',
'mockapp-production-pets',
'mockapp-staging-accounts',
'mockapp-staging-arc-sessions',
'mockapp-staging-pets'
]
}
default tables present
✔ found arc-sessions
✔ found mockapp-production-arc-sessions
✔ found mockapp-staging-arc-sessions
can insert a row
✔ got result
{}
can read index in arc 6
✔ email-index
can read index in arc 6
✔ two
✔ petID-index
✔ accountID-petID-index
can read the row
✔ got result
{}
can query the index
✔ got result
{
Items: [ { accountID: [Object], email: [Object] } ],
Count: 1,
ScannedCount: 1
}
db.close
✔ db closed
db.start
✔ got db
[?25l
✔ Got Dynamo client
[?25l
✔ @tables created in local database
true
can list tables
✔ got tables
{
TableNames: [
'arc-sessions',
'mockapp-production-accounts',
'mockapp-production-arc-sessions',
'mockapp-production-pets',
'mockapp-staging-accounts',
'mockapp-staging-arc-sessions',
'mockapp-staging-pets'
]
}
default tables present
✔ found arc-sessions
✔ found mockapp-production-arc-sessions
✔ found mockapp-staging-arc-sessions
can insert a row
✔ got result
{}
can read index in arc 5
[
{
IndexName: 'mockapp-production-accounts-email-index',
KeySchema: [ [Object] ],
Projection: { ProjectionType: 'ALL' },
IndexStatus: 'ACTIVE',
ProvisionedThroughput: {
NumberOfDecreasesToday: 0,
ReadCapacityUnits: 5,
WriteCapacityUnits: 5
},
IndexSizeBytes: 0,
ItemCount: 0,
IndexArn: 'arn:aws:dynamodb:us-east-1:000000000000:table/mockapp-production-accounts/index/mockapp-production-accounts-email-index'
}
]
✔ email-index
can read index in arc 5
✔ two
✔ petID-index
✔ accountID-petID-index
can read the row
✔ got result
{}
can query the index
✔ got result
{
Items: [ { accountID: [Object], email: [Object] } ],
Count: 1,
ScannedCount: 1
}
db.close
✔ db closed
✔ Switched back to original working dir
events.start
✔ events
[?25l
✔ @events mounted
arc.events.publish
@event {
"name": "ping",
"payload": {
"yay": true,
"yas": "queen"
}
}
✔ published
arc.queues.publish
✔ published
events.close
✔ Switched back to original working dir
@queue {
"name": "pong",
"payload": {
"most": "bes"
}
}
@queue pong failed with Error: Lambda not found: /home/ubuntu/src/architect-sandbox/src/queues/pong
at invokeLambda (/home/ubuntu/src/architect-sandbox/src/invoke-lambda/index.js:35:14)
at process.msg (/home/ubuntu/src/architect-sandbox/src/events/_subprocess.js:6:3)
at process.emit (events.js:314:20)
at emit (internal/child_process.js:906:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
hit event {
"Records": [
{
"Sns": {
"Message": "{\"yay\":true,\"yas\":\"queen\"}"
}
}
]
}
@event ping complete
✔ @events closed
env
✔ got sandbox
✔ got http
http.start
[?25l
[?25l
✓ Sandbox Loaded routes
get / ........................................... get-index
get /binary ..................................... get-binary
get /nodejs12.x ................................. get-nodejs12_x
get /nodejs10.x ................................. get-nodejs10_x
get /nodejs8.10 ................................. get-nodejs8_10
get /python3.8 .................................. get-python3_8
get /python3.7 .................................. get-python3_7
get /python3.6 .................................. get-python3_6
get /ruby2.5 .................................... get-ruby2_5
get /deno ....................................... get-deno
post /post ....................................... post-post
put /put ........................................ put-put
patch /patch ...................................... patch-patch
delete /delete ..................................... delete-delete
✔ Arc v5 deprecated status NOT set
✔ @http mounted
get /
[?25l
✔ got /
✔ is hello world
{
data: {
body: 'Hello from Architect Sandbox running the default runtime!',
headers: {
'content-type': 'application/json; charset=utf-8',
date: 'Mon, 27 Jul 2020 18:33:37 GMT',
connection: 'close',
'content-length': '59'
}
}
}
get /binary
[?25l
✔ got /binary
✔ is binary
{
data: {
body: '\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00 \x00h\x04\x00\x00\x16\x00\x00\x00(\x00\x00\x00\x10\x00\x00\x00 \x00\x00\x00\x01\x00 \x00\x00\x00\x00\x00\x00\x04\x00\x00\x12\x0B\x00\x00\x12\x0B\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00���������������������������������������������������������\x7F\x00��\x7F\x00��\x7F\x00��������������������������������������������������\x7F\x00��\x7F\x00����������\x7F\x00������������������������������������������\x7F\x00��\x7F\x00������������������\x7F\x00����������������������������������\x7F\x00��\x7F\x00��������������������������\x7F\x00��������������������������\x7F\x00��\x7F\x00����������������������������������\x7F\x00������������������\x7F\x00��\x7F\x00������������������������������������������\x7F\x00����������\x7F\x00��\x7F\x00��������������������������������������������������\x7F\x00��\x7F\x00��\x7F\x00����������������������������������������������������������\x7F\x00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
headers: {
'content-type': 'image/x-icon',
date: 'Mon, 27 Jul 2020 18:33:37 GMT',
connection: 'close',
'content-length': '1150'
}
}
}
get /nodejs12.x
[?25l
✔ got /
✔ is hello world
{
data: {
body: 'Hello from Architect Sandbox running nodejs12.x!',
headers: {
'content-type': 'application/json; charset=utf-8',
date: 'Mon, 27 Jul 2020 18:33:37 GMT',
connection: 'close',
'content-length': '50'
}
}
}
get /nodejs10.x
[?25l
✔ got /
✔ is hello world
{
data: {
body: 'Hello from Architect Sandbox running nodejs10.x!',
headers: {
'content-type': 'application/json; charset=utf-8',
date: 'Mon, 27 Jul 2020 18:33:37 GMT',
connection: 'close',
'content-length': '50'
}
}
}
get /nodejs8.10
[?25l
✔ got /
✔ is hello world
{
data: {
body: 'Hello from Architect Sandbox running nodejs8.10!',
headers: {
'content-type': 'application/json; charset=utf-8',
date: 'Mon, 27 Jul 2020 18:33:37 GMT',
connection: 'close',
'content-length': '50'
}
}
}
get /python3.8
[?25l
✔ got /
✔ is hello world
{
data: {
body: 'Hello from Architect Sandbox running python3.8!',
headers: {
'content-type': 'application/json; charset=utf-8',
date: 'Mon, 27 Jul 2020 18:33:37 GMT',
connection: 'close',
'content-length': '49'
}
}
}
get /python3.7
[?25l
✔ got /
✔ is hello world
{
data: {
body: 'Hello from Architect Sandbox running python3.7!',
headers: {
'content-type': 'application/json; charset=utf-8',
date: 'Mon, 27 Jul 2020 18:33:38 GMT',
connection: 'close',
'content-length': '49'
}
}
}
get /python3.6
[?25l
✔ got /
✔ is hello world
{
data: {
body: 'Hello from Architect Sandbox running python3.6!',
headers: {
'content-type': 'application/json; charset=utf-8',
date: 'Mon, 27 Jul 2020 18:33:38 GMT',
connection: 'close',
'content-length': '49'
}
}
}
get /ruby2.5
[?25l
✔ got /
✔ is hello world
{
data: {
body: 'Hello from Architect Sandbox running ruby2.5!',
headers: {
'content-type': 'application/json; charset=utf-8',
date: 'Mon, 27 Jul 2020 18:33:38 GMT',
connection: 'close',
'content-length': '47'
}
}
}
post /post
[?25l
✔ posted /post
✔ Got base64-encoded form URL-encoded body payload
✔ Got isBase64Encoded flag
{
httpMethod: 'POST',
path: '/post',
resource: '/post',
body: 'aGk9dGhlcmU=',
headers: {
'content-type': 'application/x-www-form-urlencoded',
'User-Agent': 'tiny-http',
'content-length': '8',
Host: 'localhost:6666'
},
multiValueHeaders: {
'content-type': [ 'application/x-www-form-urlencoded' ],
'User-Agent': [ 'tiny-http' ],
'content-length': [ '8' ],
Host: [ 'localhost:6666' ]
},
pathParameters: null,
queryStringParameters: null,
multiValueQueryStringParameters: null,
isBase64Encoded: true
}
put /put
[?25l
✔ put /put
✔ Got base64-encoded JSON-encoded body payload
✔ Got isBase64Encoded flag
{
httpMethod: 'PUT',
path: '/put',
resource: '/put',
body: 'eyJoaSI6InRoZXJlIn0=',
headers: {
'User-Agent': 'tiny-http',
'content-type': 'application/json; charset=utf-8',
'content-length': '14',
Host: 'localhost:6666'
},
multiValueHeaders: {
'User-Agent': [ 'tiny-http' ],
'content-type': [ 'application/json; charset=utf-8' ],
'content-length': [ '14' ],
Host: [ 'localhost:6666' ]
},
pathParameters: null,
queryStringParameters: null,
multiValueQueryStringParameters: null,
isBase64Encoded: true
}
delete /delete
[?25l
✔ deleted /delete
✔ Got base64-encoded JSON-encoded body payload
✔ Got isBase64Encoded flag
{
httpMethod: 'DELETE',
path: '/delete',
resource: '/delete',
body: 'eyJoaSI6InRoZXJlIn0=',
headers: {
'User-Agent': 'tiny-http',
'content-type': 'application/json; charset=utf-8',
'content-length': '14',
Host: 'localhost:6666'
},
multiValueHeaders: {
'User-Agent': [ 'tiny-http' ],
'content-type': [ 'application/json; charset=utf-8' ],
'content-length': [ '14' ],
Host: [ 'localhost:6666' ]
},
pathParameters: null,
queryStringParameters: { hi: 'there' },
multiValueQueryStringParameters: { hi: [ 'there' ] },
isBase64Encoded: true
}
post / (should fail, non-get calls to root do not hit get /
[?25l
✔ Errors with 403
✔ Errors with message instructing to add '@http post /' handler
http.close
✔ Sandbox succssfully shut down
sandbox.start
[?25l
App ⌁ mockapp
Region ⌁ @aws region / AWS_REGION not configured
Profile ⌁ Set via environment
Version ⌁ –
cwd ⌁ /home/ubuntu/src/architect-sandbox/test/mock/no-index-fail
[?25l
✓ Sandbox Found Architect project manifest, starting up
[?25l
[?25l
✓ Sandbox Project files hydrated into functions
[?25l
✓ Sandbox @events and @queues ready on local event bus
[?25l
[?25l
✓ Sandbox Loaded routes
get /foo ........................................ get-foo
✓ Sandbox Started in 154ms
✈︎ Local environment ready!
http://localhost:6666
⚠️ Warning: Possibly found a global install of Architect without a global install of AWS-SDK, please run: npm i -g aws-sdk
✔ Arc v5 deprecated status NOT set
✔ aws_proxy mode enabled
✔ sandbox started
get / without defining get / should fail if index.html not present
[?25l
✔ Got 404 for missing file
shut down sandbox
[?25l
✔ Sandbox succssfully shut down
sandbox.start
[?25l
App ⌁ mockapp
Region ⌁ @aws region / AWS_REGION not configured
Profile ⌁ Set via environment
Version ⌁ –
cwd ⌁ /home/ubuntu/src/architect-sandbox/test/mock/no-index-pass
[?25l
✓ Sandbox Found Architect project manifest, starting up
[?25l
[?25l
✓ Sandbox Project files hydrated into functions
[?25l
✓ Sandbox @events and @queues ready on local event bus
[?25l
[?25l
✓ Sandbox Loaded routes
get /foo ........................................ get-foo
✓ Sandbox Started in 118ms
✈︎ Local environment ready!
http://localhost:6666
⚠️ Warning: Possibly found a global install of Architect without a global install of AWS-SDK, please run: npm i -g aws-sdk
✔ Arc v5 deprecated status NOT set
✔ aws_proxy mode enabled
✔ sandbox started
get / without defining get / should succeed if index.html is present
[?25l
✔ Proxy mounted and delivered index.html
{
body: 'Hello world!',
headers: {
'content-type': 'text/html; charset=utf-8',
'cache-control': 'no-cache, no-store, must-revalidate, max-age=0, s-maxage=0',
etag: 'c0535e4be2b79ffd93291305436bf889314e4a3faec05ecffcbb7df31ad9e51a',
date: 'Mon, 27 Jul 2020 18:33:40 GMT',
connection: 'close',
'content-length': '12'
}
}
shut down sandbox
[?25l
✔ Sandbox succssfully shut down
sandbox.start
[?25l
App ⌁ mockapp
Region ⌁ @aws region / AWS_REGION not configured
Profile ⌁ Set via environment
Version ⌁ –
cwd ⌁ /home/ubuntu/src/architect-sandbox/test/mock/no-http
[?25l
✓ Sandbox Found Architect project manifest, starting up
[?25l
[?25l
✓ Sandbox Project files hydrated into functions
[?25l
✓ Sandbox @events and @queues ready on local event bus
✓ Sandbox Started in 84ms
✈︎ Local environment ready!
⚠️ Warning: Possibly found a global install of Architect without a global install of AWS-SDK, please run: npm i -g aws-sdk
✔ sandbox started
get / without defining @http
✔ Connection refused
shut down sandbox
[?25l
✔ sandbox shut down
sandbox.start
[?25l
App ⌁ mockapp
Region ⌁ @aws region / AWS_REGION not configured
Profile ⌁ Set via environment
Version ⌁ Architect 5.x
cwd ⌁ /home/ubuntu/src/architect-sandbox/test/mock/normal
[?25l
✓ Sandbox Found Architect project manifest, starting up
[?25l
✓ Hydrate Hydrated app with Architect manifest
✓ Sandbox Project files hydrated into functions
[?25l
[?25h/home/ubuntu/src/architect-sandbox/node_modules/@architect/parser/src/parser/index.js:18
if (tokens[0].type != 'pragma')
^
TypeError: Cannot read property 'type' of undefined
at parse (/home/ubuntu/src/architect-sandbox/node_modules/@architect/parser/src/parser/index.js:18:17)
at readArc (/home/ubuntu/src/architect-sandbox/node_modules/@architect/parser/src/read.js:48:11)
at arcfile (/home/ubuntu/src/architect-sandbox/src/sandbox/read-arc.js:27:35)
at Object.start (/home/ubuntu/src/architect-sandbox/src/db/index.js:13:17)
at Array._db (/home/ubuntu/src/architect-sandbox/src/sandbox/index.js:219:21)
at each (/home/ubuntu/src/architect-sandbox/node_modules/run-series/index.js:19:24)
at next (/home/ubuntu/src/architect-sandbox/src/sandbox/index.js:209:11)
at done (/home/ubuntu/src/architect-sandbox/node_modules/@architect/hydrate/index.js:39:10)
at end (/home/ubuntu/src/architect-sandbox/node_modules/run-series/index.js:10:15)
at done (/home/ubuntu/src/architect-sandbox/node_modules/run-series/index.js:13:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @architect/sandbox@1.13.0 test:integration: `cross-env PORT=6666 tape 'test/integration/**/*-test.js' | tap-spec`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @architect/sandbox@1.13.0 test:integration script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2020-07-27T18_33_40_353Z-debug.log
npm ERR! Test failed. See above for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment