Skip to content

Commit 1016e51

Browse files
committed
Added omitted unit test and moved checks for Durable Client into GetDurableClientFromModulePrivateData function
1 parent 2061207 commit 1016e51

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

src/Modules/Microsoft.Azure.Functions.PowerShellWorker/Microsoft.Azure.Functions.PowerShellWorker.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ CmdletsToExport = @(
6161
'Invoke-ActivityFunction',
6262
'Push-OutputBinding',
6363
'Set-FunctionInvocationContext',
64-
"Start-DurableExternalEventListener",
64+
'Start-DurableExternalEventListener',
6565
'Start-DurableTimer',
6666
'Stop-DurableTimerTask',
6767
'Trace-PipelineObject',

src/Modules/Microsoft.Azure.Functions.PowerShellWorker/Microsoft.Azure.Functions.PowerShellWorker.psm1

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ Set-Alias -Name Wait-ActivityFunction -Value Wait-DurableTask
88

99
function GetDurableClientFromModulePrivateData {
1010
$PrivateData = $PSCmdlet.MyInvocation.MyCommand.Module.PrivateData
11-
if ($PrivateData) {
11+
if ($PrivateData -eq $null -or $PrivateData['DurableClient'] -eq $null) {
12+
throw "No binding of the type 'durableClient' was defined."
13+
}
14+
else {
1215
$PrivateData['DurableClient']
1316
}
1417
}
@@ -50,9 +53,6 @@ function Start-NewOrchestration {
5053

5154
if ($null -eq $DurableClient) {
5255
$DurableClient = GetDurableClientFromModulePrivateData
53-
if ($null -eq $DurableClient) {
54-
throw "Cannot start an orchestration function. No binding of the type 'durableClient' was defined."
55-
}
5656
}
5757

5858
$InstanceId = (New-Guid).Guid
@@ -98,9 +98,6 @@ function New-OrchestrationCheckStatusResponse {
9898

9999
if ($null -eq $DurableClient) {
100100
$DurableClient = GetDurableClientFromModulePrivateData
101-
if ($null -eq $DurableClient) {
102-
throw "Cannot create orchestration check status response. No binding of the type 'durableClient' was defined."
103-
}
104101
}
105102

106103
[uri]$requestUrl = $Request.Url
@@ -172,22 +169,15 @@ function Send-DurableExternalEvent {
172169
[object] $EventData,
173170

174171
[Parameter(
175-
Position=3,
176172
ValueFromPipelineByPropertyName=$true)]
177173
[string] $TaskHubName,
178174

179175
[Parameter(
180-
Position=4,
181176
ValueFromPipelineByPropertyName=$true)]
182177
[string] $ConnectionName
183178
)
184-
185-
CheckIfDurableFunctionsEnabled
186179

187180
$DurableClient = GetDurableClientFromModulePrivateData
188-
if ($null -eq $DurableClient) {
189-
throw "Cannot send an external event to an orchestration function. No binding of the type 'durableClient' was defined."
190-
}
191181

192182
$RequestUrl = GetRaiseEventUrl -DurableClient $DurableClient -InstanceId $InstanceId -EventName $EventName -TaskHubName $TaskHubName -ConnectionName $ConnectionName
193183

test/Unit/Durable/DurableTaskHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public void WaitAny_OutputsEarliestCompletedTask_WhenAnyTaskCompleted(bool compl
161161
}
162162

163163
[Theory]
164-
// [InlineData(false, true)]
164+
[InlineData(false, true)]
165165
[InlineData(true, false)]
166166
public void WaitAny_WaitsForStop_WhenAllTasksAreNotCompleted(bool completed, bool expectedWaitForStop)
167167
{

0 commit comments

Comments
 (0)