-
Notifications
You must be signed in to change notification settings - Fork 475
Update CosmosDB E2E Tests w/ Emulator #11503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
0ea45e0
1d281fa
74c4201
57c3359
3f9fa75
b7967d7
d5ea35b
768e70c
f7c7f6c
ddb5462
616c548
0d648ee
ae2ca92
d5b162b
68f442a
19ae8e6
5627b87
90a99c6
810a125
2643d43
12e0885
a0ff711
af0fbe6
8f3e30d
5b4601f
e67771a
8965a8b
0606669
6454b2d
373eda6
58755de
c09f380
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,28 @@ | ||
| { | ||
| { | ||
| "bindings": [ | ||
| { | ||
| "type": "queueTrigger", | ||
| "name": "input", | ||
| "queueName": "documentdb-input-node", | ||
| "queueName": "cosmosdb-input-node", | ||
| "direction": "in" | ||
| }, | ||
| { | ||
| "type": "cosmosDB", | ||
| "name": "itemIn", | ||
| "direction": "in", | ||
| "databaseName": "ItemDb", | ||
| "collectionName": "ItemCollection", | ||
| "id": "{documentId}" | ||
| }, | ||
| { | ||
| "type": "cosmosDB", | ||
| "name": "relatedItems", | ||
| "direction": "in", | ||
| "databaseName": "ItemDb", | ||
| "collectionName": "ItemCollection", | ||
| "sqlQuery": "SELECT f.id, f.related FROM f WHERE f.related = {documentId}" | ||
| "databaseName": "InOutItemDb", | ||
| "containerName": "ItemCollection", | ||
| "partitionKey": "{id}", | ||
| "id": "{id}" | ||
| }, | ||
| { | ||
| "type": "cosmosDB", | ||
| "name": "itemOut", | ||
| "direction": "out", | ||
| "databaseName": "ItemDb", | ||
| "collectionName": "ItemCollection", | ||
| "createIfNotExists": true | ||
| "databaseName": "InOutItemDb", | ||
| "containerName": "ItemCollection", | ||
| "createIfNotExists": true, | ||
| "partitionKey": "{id}" | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "bindings": [ | ||
| { | ||
| "type": "queueTrigger", | ||
| "name": "input", | ||
| "queueName": "cosmosdb-input-multiple-node", | ||
| "direction": "in" | ||
| }, | ||
| { | ||
| "name": "items", | ||
| "type": "cosmosDB", | ||
| "direction": "in", | ||
| "databaseName": "MultipleInOutItemDb", | ||
| "containerName": "ItemCollection", | ||
| "sqlQuery": "SELECT * from c where c.text = {id}" | ||
| }, | ||
| { | ||
| "type": "cosmosDB", | ||
| "name": "itemOut", | ||
| "direction": "out", | ||
| "databaseName": "MultipleInOutItemDb", | ||
| "containerName": "ItemCollection", | ||
| "createIfNotExists": true | ||
| } | ||
|
Comment on lines
+9
to
+24
|
||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| module.exports = function (context, input) { | ||
|
|
||
| context.log(context.bindings); | ||
|
|
||
| if (context.bindings.items.length !== 2) { | ||
| throw Error("Expected 2 documents. Found " + context.bindings.items.length); | ||
| } | ||
|
|
||
| context.bindings.itemOut = { | ||
| id: input.id, | ||
| text: "Hello from Node with multiple input bindings!" | ||
| }; | ||
|
|
||
| context.done(); | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,24 +1,16 @@ | ||||||||
| { | ||||||||
| { | ||||||||
| "bindings": [ | ||||||||
| { | ||||||||
| "type": "manualTrigger", | ||||||||
| "name": "input", | ||||||||
| "direction": "in" | ||||||||
| }, | ||||||||
| { | ||||||||
| "type": "cosmosDB", | ||||||||
| "name": "relatedItems", | ||||||||
| "direction": "out", | ||||||||
| "databaseName": "ItemDb", | ||||||||
| "collectionName": "ItemCollection", | ||||||||
| "createIfNotExists": true | ||||||||
| }, | ||||||||
| { | ||||||||
| "type": "cosmosDB", | ||||||||
| "name": "item", | ||||||||
| "direction": "out", | ||||||||
|
||||||||
| "direction": "out", | |
| "direction": "out", | |
| "connection": "CosmosDB", |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||||
| { | ||||||||
| "bindings": [ | ||||||||
| { | ||||||||
| "type": "manualTrigger", | ||||||||
| "name": "input", | ||||||||
| "direction": "in" | ||||||||
| }, | ||||||||
| { | ||||||||
| "type": "cosmosDB", | ||||||||
| "name": "items", | ||||||||
| "direction": "out", | ||||||||
| "databaseName": "MultipleInOutItemDb", | ||||||||
| "containerName": "ItemCollection", | ||||||||
| "createIfNotExists": true | ||||||||
|
||||||||
| "createIfNotExists": true | |
| "createIfNotExists": true, | |
| "connection": "CosmosDB" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| module.exports = function (context, input) { | ||
| context.log('Node.js function triggered with input', input); | ||
|
|
||
| context.bindings.items = JSON.stringify([ | ||
| { | ||
| "id": input + "-0", | ||
| "text": input | ||
| }, | ||
| { | ||
| "id": input + "-1", | ||
| "text": input | ||
| }]); | ||
|
|
||
| context.done(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "connection" property is missing from all three CosmosDB bindings. While this may work with default connection string settings, it's inconsistent with the CosmosDBTrigger function.json which includes "connection": "CosmosDB". For consistency and clarity, all CosmosDB bindings should explicitly specify the connection property.