Update E2E tests to use Core Tools(#198)

This commit is contained in:
Pragna Gopa 2018-10-10 15:54:47 -07:00 коммит произвёл GitHub
Родитель be393d7b88
Коммит 890f24b178
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 40 добавлений и 40 удалений

2
.gitignore поставляемый
Просмотреть файл

@ -267,3 +267,5 @@ pkg/
/.metadata/
/.recommenders/*
/Azure.Functions.Cli.zip
/Azure.Functions.Cli/

Просмотреть файл

@ -23,13 +23,9 @@ install:
- ps: Get-Command nuget
- cmd: echo %JAVA_HOME%
- cmd: dotnet --info
- cmd: npm i -g azure-functions-core-tools
build_script:
- cmd: mvn clean package -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
- cmd: cd c:\projects\azure-functions-java-worker\endtoendtests
- cmd: mvn clean package -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B
- cmd: cd c:\projects\azure-functions-java-worker
- ps: |
$buildNumber = 0
if($env:APPVEYOR_REPO_TAG -eq "true") {
@ -50,14 +46,14 @@ cache:
after_build:
- ps: |
Write-Host "Deleting Functions Host Binaries if exists...."
Remove-Item -Force ./Functions.Binaries.zip -ErrorAction Ignore
Remove-Item -Recurse -Force ./Functions.Binaries -ErrorAction Ignore
Write-Host "Deleting Functions Core Tools if exists...."
Remove-Item -Force ./Azure.Functions.Cli.zip -ErrorAction Ignore
Remove-Item -Recurse -Force ./Azure.Functions.Cli -ErrorAction Ignore
Write-Host "Downloading Functions Host...."
$url = "https://ci.appveyor.com/api/buildjobs/5tki14blq24k9mgm/artifacts/Functions.Binaries.2.0.12118.no-runtime.zip"
$output = "c:\projects\azure-functions-java-worker\Functions.Binaries.zip"
$url = "https://functionsclibuilds.blob.core.windows.net/builds/2/latest/Azure.Functions.Cli.win-x86.zip"
$output = "c:\projects\azure-functions-java-worker\Azure.Functions.Cli.zip"
$start_time = Get-Date
$wc = New-Object System.Net.WebClient
@ -65,12 +61,12 @@ after_build:
Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
Write-Host "Extracting Functions Host...."
Expand-Archive "c:\projects\azure-functions-java-worker\Functions.Binaries.zip" -DestinationPath "c:\projects\azure-functions-java-worker\Functions.Binaries"
Write-Host "Extracting Functions Core Tools...."
Expand-Archive "c:\projects\azure-functions-java-worker\Azure.Functions.Cli.zip" -DestinationPath "c:\projects\azure-functions-java-worker\Azure.Functions.Cli"
Write-Host "Copying azure-functions-java-worker to Functions Host workers directory...."
Get-ChildItem -Path .\target\* -Include 'azure*' -Exclude '*shaded.jar' | %{ Copy-Item $_.FullName ".\Functions.Binaries\workers\java\azure-functions-java-worker.jar" }
Get-ChildItem -Path .\target\* -Include 'azure*' -Exclude '*shaded.jar' | %{ Copy-Item $_.FullName ".\Azure.Functions.Cli\workers\java\azure-functions-java-worker.jar" }
Write-Host "Staring Functions Host...."
@ -78,10 +74,15 @@ after_build:
$Env:AzureWebJobsScriptRoot = "c:\projects\azure-functions-java-worker\endtoendtests\target\azure-functions\azure-functions-java-endtoendtests"
$Env:FUNCTIONS_WORKER_RUNTIME = "java"
$Env:AZURE_FUNCTIONS_ENVIRONMENT = "development"
$Env:Path = $Env:Path+";c:\projects\azure-functions-java-worker\Azure.Functions.Cli"
cd -Path c:\projects\azure-functions-java-worker\endtoendtests
mvn clean package
cd -Path c:\projects\azure-functions-java-worker
Write-Host $Env:AzureWebJobsScriptRoot
$proc = start-process -filepath dotnet -ArgumentList "c:\projects\azure-functions-java-worker\Functions.Binaries\Microsoft.Azure.WebJobs.Script.WebHost.dll" -PassThru
$proc = start-process -filepath c:\projects\azure-functions-java-worker\Azure.Functions.Cli\func.exe -WorkingDirectory "c:\projects\azure-functions-java-worker\endtoendtests\target\azure-functions\azure-functions-java-endtoendtests" -ArgumentList "host start" -PassThru
# wait for host to start
Start-Sleep -s 30

Просмотреть файл

@ -10,11 +10,6 @@ function StopOnFailedExecution {
Write-Host "Building azure-function-java-worker"
mvn clean package
StopOnFailedExecution
Write-Host "Building azure-functions-java-endtoendtests"
Push-Location -Path .\endtoendtests
mvn clean package
StopOnFailedExecution
Pop-Location
Write-Host "Starting azure-functions-java-endtoendtests execution"
.\run-tests-local.ps1

Просмотреть файл

@ -7,7 +7,7 @@ namespace Azure.Functions.Java.Tests.E2E
{
public static class Constants
{
public static string FunctionsHostUrl = "http://localhost:5000";
public static string FunctionsHostUrl = "http://localhost:7071";
public static string StorageConnectionStringSetting = Environment.GetEnvironmentVariable("AzureWebJobsStorage");
//Queue tests

Просмотреть файл

@ -15,14 +15,12 @@ namespace Azure.Functions.Java.Tests.E2E
{
[Theory]
[InlineData("HttpTriggerJava", "?&name=Test", HttpStatusCode.OK, "")]
[InlineData("HttpTriggerJavaThrows", "", HttpStatusCode.InternalServerError, "Test Exception")]
[InlineData("HttpTriggerJavaThrows", "", HttpStatusCode.InternalServerError, "")]
[InlineData("HttpTriggerJava", "", HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body")]
public async Task HttpTriggerTests(string functionName, string queryString, HttpStatusCode expectedStatusCode, string expectedErrorMessage)
{
// TODO: Get function key
//string functionKey = await _fixture.Host.GetFunctionSecretAsync($"{functionName}");
//string uri = $"api/{functionName}?code={functionKey}&name=Mathew";
// TODO: Verify exception on 500 after https://github.com/Azure/azure-functions-host/issues/3589
await InvokeHttpTrigger(functionName, queryString, expectedStatusCode, expectedErrorMessage);
}

Просмотреть файл

@ -1,7 +1,6 @@
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"AzureWebJobsServiceBus": "",
"AzureWebJobsEventHubReceiver":"",
"AzureWebJobsEventHubSender":"",

Просмотреть файл

@ -1,4 +1,3 @@
function RunTest([string] $project, [string] $description,[bool] $skipBuild = $false, $filter = $null) {
Write-Host "Running test: $description" -ForegroundColor DarkCyan
Write-Host "-----------------------------------------------------------------------------" -ForegroundColor DarkCyan
@ -29,38 +28,44 @@ $success = $true
$testRunSucceeded = $true
Write-Host "Deleting Functions Host Binaries if exists...."
Remove-Item -Force ./Functions.Binaries.zip -ErrorAction Ignore
Remove-Item -Recurse -Force ./Functions.Binaries -ErrorAction Ignore
Write-Host "Deleting Functions Core Tools if exists...."
Remove-Item -Force ./Azure.Functions.Cli.zip -ErrorAction Ignore
Remove-Item -Recurse -Force ./Azure.Functions.Cli -ErrorAction Ignore
Write-Host "Downloading Functions Host...."
Write-Host "Downloading Functions Core Tools...."
$url = "https://ci.appveyor.com/api/buildjobs/5tki14blq24k9mgm/artifacts/Functions.Binaries.2.0.12118.no-runtime.zip"
$output = "$PSScriptRoot\Functions.Binaries.zip"
$url = "https://functionsclibuilds.blob.core.windows.net/builds/2/latest/Azure.Functions.Cli.win-x86.zip"
$output = "$PSScriptRoot\Azure.Functions.Cli.zip"
$start_time = Get-Date
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $output)
Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
Write-Host "Extracting Functions Host...."
Expand-Archive "$PSScriptRoot\Functions.Binaries.zip" -DestinationPath "$PSScriptRoot\Functions.Binaries"
Write-Host "Extracting Functions Core Tools...."
Expand-Archive "$PSScriptRoot\Azure.Functions.Cli.zip" -DestinationPath "$PSScriptRoot\Azure.Functions.Cli"
Write-Host "Copying azure-functions-java-worker to Functions Host workers directory...."
Get-ChildItem -Path .\target\* -Include 'azure*' -Exclude '*shaded.jar' | %{ Copy-Item $_.FullName ".\Functions.Binaries\workers\java\azure-functions-java-worker.jar" }
Get-ChildItem -Path .\target\* -Include 'azure*' -Exclude '*shaded.jar' | %{ Copy-Item $_.FullName ".\Azure.Functions.Cli\workers\java\azure-functions-java-worker.jar" }
Write-Host "Staring Functions Host...."
$Env:AzureWebJobsScriptRoot = "$PSScriptRoot\endtoendtests\target\azure-functions\azure-functions-java-endtoendtests"
$Env:FUNCTIONS_WORKER_RUNTIME = "java"
$Env:AZURE_FUNCTIONS_ENVIRONMENT = "development"
$Env:Path = $Env:Path+";$PSScriptRoot\Azure.Functions.Cli"
Write-Host $Env:AzureWebJobsScriptRoot
$Env:Path = $Env:Path+";$PSScriptRoot\Azure.Functions.Cli"
$proc = start-process -filepath dotnet -ArgumentList "$PSScriptRoot\Functions.Binaries\Microsoft.Azure.WebJobs.Script.WebHost.dll" -PassThru
Write-Host "Building azure-functions-java-worker\endtoendtests...."
Write-Host "Building azure-functions-java-endtoendtests"
Push-Location -Path .\endtoendtests
mvn clean package
StopOnFailedExecution
Pop-Location
$proc = start-process -filepath func.exe -WorkingDirectory "$PSScriptRoot\endtoendtests\target\azure-functions\azure-functions-java-endtoendtests" -ArgumentList "host start" -PassThru
# wait for host to start
Start-Sleep -s 30