Skip to content

Commit 834a118

Browse files
added E2E test with fix of E2E tests
1 parent bfa8bb0 commit 834a118

File tree

5 files changed

+45
-5
lines changed

5 files changed

+45
-5
lines changed

test/E2E/HttpTrigger.Tests.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ Describe 'HttpTrigger Tests' {
2424
@{
2525
FunctionName = 'TestBasicHttpTriggerWithTriggerMetadata'
2626
ExpectedContent = 'Hello Atlas'
27+
},
28+
@{
29+
FunctionName = 'TestBasicHttpTriggerWithProfile'
30+
ExpectedContent = 'PROFILE'
2731
}
2832
) {
29-
param ($ExpectedContent)
33+
param ($FunctionName, $ExpectedContent)
3034

31-
$res = Invoke-WebRequest "$FUNCTIONS_BASE_URL/api/TestBasicHttpTrigger?Name=Atlas"
35+
$res = Invoke-WebRequest "$FUNCTIONS_BASE_URL/api/$($FunctionName)?Name=Atlas"
3236

3337
$res.StatusCode | Should -Be ([HttpStatusCode]::Accepted)
3438
$res.Content | Should -Be $ExpectedContent
@@ -50,12 +54,12 @@ Describe 'HttpTrigger Tests' {
5054
FunctionName = 'TestBasicHttpTriggerWithTriggerMetadata'
5155
}
5256
) {
53-
param ($InputNameData)
57+
param ($FunctionName, $InputNameData)
5458

5559
if (Test-Path 'variable:InputNameData') {
56-
$url = "$FUNCTIONS_BASE_URL/api/TestBasicHttpTrigger?Name=$InputNameData"
60+
$url = "$FUNCTIONS_BASE_URL/api/$($FunctionName)?Name=$InputNameData"
5761
} else {
58-
$url = "$FUNCTIONS_BASE_URL/api/TestBasicHttpTrigger"
62+
$url = "$FUNCTIONS_BASE_URL/api/$($FunctionName)"
5963
}
6064

6165
$res = { invoke-webrequest $url } |

test/E2E/TestFunctionApp/Profile.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function Get-ProfileString {
2+
"PROFILE"
3+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"disabled": false,
3+
"bindings": [
4+
{
5+
"authLevel": "function",
6+
"type": "httpTrigger",
7+
"direction": "in",
8+
"name": "req",
9+
"methods": [
10+
"get",
11+
"post"
12+
]
13+
},
14+
{
15+
"type": "http",
16+
"direction": "out",
17+
"name": "res"
18+
}
19+
]
20+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# Copyright (c) Microsoft. All rights reserved.
3+
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
4+
#
5+
6+
# Input bindings are passed in via param block.
7+
param($req)
8+
9+
Push-OutputBinding -Name res -Value ([HttpResponseContext]@{
10+
StatusCode = 202
11+
Body = (Get-ProfileString)
12+
})

test/E2E/setupE2Etests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Expand-Archive $output -DestinationPath $FUNC_CLI_DIRECTORY
3535
Write-Host "Copying azure-functions-powershell-worker to Functions Host workers directory..."
3636

3737
$configuration = if ($env:CONFIGURATION) { $env:CONFIGURATION } else { 'Debug' }
38+
Remove-Item -Recurse -Force -Path "$FUNC_CLI_DIRECTORY/workers/powershell"
3839
Copy-Item -Recurse -Force "$PSScriptRoot/../../src/bin/$configuration/netcoreapp2.1/publish/" "$FUNC_CLI_DIRECTORY/workers/powershell"
3940

4041
Write-Host "Staring Functions Host..."

0 commit comments

Comments
 (0)