Skip to content

Commit 39db7e0

Browse files
authored
Fixes DefaultPK test for PowerShell (Azure#626)
* support for defaultPK * use ordered for deafult PK
1 parent 1cba30a commit 39db7e0

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

samples/samples-powershell/AddProductWithDefaultPK/run.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ Write-Host "PowerShell function with SQL Output Binding processed a request."
1111

1212
# Note that this expects the body to be a JSON object or array of objects
1313
# which have a property matching each of the columns in the table to upsert to.
14-
$req_body = $Request.Body
14+
# Output bindings require the [ordered] attribute. See https://github.com/Azure/azure-functions-sql-extension#output-bindings for more details.
15+
$req_query = [ordered]@{
16+
Name=$Request.QUERY.name;
17+
Cost=$Request.QUERY.cost;
18+
};
1519

1620
# Assign the value we want to pass to the SQL Output binding.
1721
# The -Name value corresponds to the name property in the function.json for the binding
18-
Push-OutputBinding -Name products -Value $req_body
22+
Push-OutputBinding -Name products -Value $req_query
1923

2024
# Assign the value to return as the HTTP response.
2125
# The -Name value matches the name property in the function.json for the binding
2226
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
2327
StatusCode = [HttpStatusCode]::OK
24-
Body = $req_body
28+
Body = $req_query
2529
})

test/Integration/SqlOutputBindingIntegrationTests.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,6 @@ public void AddProductWithIdentity_MissingPrimaryColumn(SupportedLanguages lang)
355355
/// </summary>
356356
[Theory]
357357
[SqlInlineData()]
358-
// Currently PowerShell gives an unknown error (when testing locally we get a missing primary key error)
359-
// Issue link: https://github.com/Azure/azure-functions-sql-extension/issues/448
360-
[UnsupportedLanguages(SupportedLanguages.PowerShell)]
361358
public void AddProductWithDefaultPKTest(SupportedLanguages lang)
362359
{
363360
this.StartFunctionHost(nameof(AddProductWithDefaultPK), lang);

0 commit comments

Comments
 (0)