Skip to content

Commit

Permalink
Initial Integration tests - closes #894
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Oct 29, 2015
1 parent 51eaeb3 commit 8b00641
Show file tree
Hide file tree
Showing 42 changed files with 361 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ language: csharp
sudo: false # use the new container-based Travis infrastructure

script:
- ./build.sh All
- ./build.sh RunIntegrationTests
7 changes: 7 additions & 0 deletions Paket.sln
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "commands", "commands", "{44
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paket.Bootstrapper.Tests", "tests\Paket.Bootstrapper.Tests\Paket.Bootstrapper.Tests.csproj", "{7C622582-E281-4EAB-AADA-B5893BB89B45}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Paket.IntegrationTests", "integrationtests\Paket.IntegrationTests\Paket.IntegrationTests.fsproj", "{7234B9B4-8CF5-4E68-AA29-050C087B9246}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -103,6 +105,10 @@ Global
{7C622582-E281-4EAB-AADA-B5893BB89B45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C622582-E281-4EAB-AADA-B5893BB89B45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C622582-E281-4EAB-AADA-B5893BB89B45}.Release|Any CPU.Build.0 = Release|Any CPU
{7234B9B4-8CF5-4E68-AA29-050C087B9246}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7234B9B4-8CF5-4E68-AA29-050C087B9246}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7234B9B4-8CF5-4E68-AA29-050C087B9246}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7234B9B4-8CF5-4E68-AA29-050C087B9246}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -113,5 +119,6 @@ Global
{E789C72A-5CFD-436B-8EF1-61AA2852A89F} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4}
{4425A246-BD18-4622-86B5-0154F19165E4} = {8E6D5255-776D-4B61-85F9-73C37AA1FB9A}
{7C622582-E281-4EAB-AADA-B5893BB89B45} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4}
{7234B9B4-8CF5-4E68-AA29-050C087B9246} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
init:
- git config --global core.autocrlf input
build_script:
- cmd: build.cmd All
- cmd: build.cmd RunIntegrationTests
test: off
version: 0.0.1.{build}
artifacts:
Expand Down
15 changes: 14 additions & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ let solutionFilePowerShell = "Paket.PowerShell.sln"

// Pattern specifying assemblies to be tested using NUnit
let testAssemblies = "tests/**/bin/Release/*Tests*.dll"
let integrationTestAssemblies = "integrationtests/**/bin/Release/*Tests*.dll"

// Git configuration (used for publishing documentation in gh-pages branch)
// The profile where the project is posted
Expand Down Expand Up @@ -163,6 +164,17 @@ Target "RunTests" (fun _ ->
OutputFile = "TestResults.xml" })
)


Target "RunIntegrationTests" (fun _ ->
!! integrationTestAssemblies
|> NUnit (fun p ->
{ p with
DisableShadowCopy = true
TimeOut = TimeSpan.FromMinutes 20.
OutputFile = "TestResults.xml" })
)


// --------------------------------------------------------------------------------------
// Build a NuGet package

Expand Down Expand Up @@ -410,6 +422,7 @@ Target "All" DoNothing
=?> ("ReleaseDocs",isLocalBuild && not isMono)

"All"
==> "RunIntegrationTests"
==> "MergePaketTool"
=?> ("MergePowerShell", not isMono)
==> "SignAssemblies"
Expand All @@ -431,7 +444,7 @@ Target "All" DoNothing
==> "PublishChocolatey"
==> "PublishNuGet"

"PublishNuGet"
"PublishNuGet"
==> "ReleaseGitHub"
==> "Release"

Expand Down
9 changes: 9 additions & 0 deletions integrationtests/Paket.IntegrationTests/AssemblyInfo.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace System
open System.Reflection

[<assembly: AssemblyTitleAttribute("Paket.IntegrationTests")>]
[<assembly: AssemblyProductAttribute("Paket")>]
[<assembly: AssemblyDescriptionAttribute("A description")>]
[<assembly: AssemblyCompanyAttribute("Two, Authors")>]
[<assembly: AssemblyVersionAttribute("1.0.0.0")>]
do ()
173 changes: 173 additions & 0 deletions integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7234b9b4-8cf5-4e68-aa29-050c087b9246}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Paket.Tests</RootNamespace>
<AssemblyName>Paket.IntegrationTests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFSharpCoreVersion>4.3.0.0</TargetFSharpCoreVersion>
<Name>Paket.Tests</Name>
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<StartAction>Project</StartAction>
<StartProgram>
</StartProgram>
<StartArguments>
</StartArguments>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Tailcalls>true</Tailcalls>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
</PropertyGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' != '11.0' and Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
<PropertyGroup>
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<When Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')">
<PropertyGroup>
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<When Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
<PropertyGroup>
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<When Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\4.0\Framework\v4.0\Microsoft.FSharp.Targets')">
<PropertyGroup>
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\4.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
</Choose>
<Import Project="$(FSharpTargetsPath)" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Import Project="$(SolutionDir)\.paket\paket.targets" />
<ItemGroup>
<Compile Include="..\..\paket-files\test\forki\FsUnit\FsUnit.fs">
<Paket>True</Paket>
<Link>FsUnit.fs</Link>
</Compile>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="TestHelper.fs" />
<Compile Include="ResolverFailsFastSpecs.fs" />
<None Include="paket.references" />
</ItemGroup>
<ItemGroup>
<Reference Include="FakeLib">
<HintPath>..\..\packages\build\FAKE\tools\FakeLib.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Numerics" />
<Reference Include="System.Security" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<Import Project="Paket.Tests.paket.targets" Condition="Exists('Paket.Tests.paket.targets')" />
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5')">
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\..\packages\FSharp.Core\lib\net20\FSharp.Core.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6')">
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\..\packages\FSharp.Core\lib\net40\FSharp.Core.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETCore') Or ($(TargetFrameworkIdentifier) == 'Xamarin.Mac') Or ($(TargetFrameworkProfile) == 'Profile7') Or ($(TargetFrameworkProfile) == 'Profile44')">
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+netcore45\FSharp.Core.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch') Or ($(TargetFrameworkIdentifier) == 'Xamarin.iOS')">
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == 'Silverlight' And $(TargetFrameworkVersion) == 'v5.0') Or ($(TargetFrameworkProfile) == 'Profile24') Or ($(TargetFrameworkProfile) == 'Profile47')">
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+sl5+netcore45\FSharp.Core.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == 'WindowsPhone' And ($(TargetFrameworkVersion) == 'v8.0' Or $(TargetFrameworkVersion) == 'v8.1')) Or ($(TargetFrameworkProfile) == 'Profile31') Or ($(TargetFrameworkProfile) == 'Profile49') Or ($(TargetFrameworkProfile) == 'Profile78')">
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wp8\FSharp.Core.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == 'WindowsPhoneApp') Or ($(TargetFrameworkProfile) == 'Profile32') Or ($(TargetFrameworkProfile) == 'Profile84') Or ($(TargetFrameworkProfile) == 'Profile111') Or ($(TargetFrameworkProfile) == 'Profile151') Or ($(TargetFrameworkProfile) == 'Profile157') Or ($(TargetFrameworkProfile) == 'Profile259')">
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wpa81+wp8\FSharp.Core.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</Project>
16 changes: 16 additions & 0 deletions integrationtests/Paket.IntegrationTests/ResolverFailsFastSpecs.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module Paket.IntegrationTests.ResolverFailsFastSpecs

open Fake
open System
open NUnit.Framework
open FsUnit
open System
open System.IO

[<Test>]
let ``#166 Should resolve Nancy without timeount``() =
update "i001166-resolve-nancy-fast"

[<Test>]
let ``#1174 Should find Ninject error``() =
updateShouldFindPackageConflict "Ninject" "i001174-resolve-fast-conflict"
29 changes: 29 additions & 0 deletions integrationtests/Paket.IntegrationTests/TestHelper.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[<AutoOpen>]
module Paket.IntegrationTests.TestHelpers

open Fake
open System
open NUnit.Framework
open FsUnit
open System
open System.IO

let paketToolPath = FullName(__SOURCE_DIRECTORY__ + "../../../bin/paket.exe")
let integrationTestPath = FullName(__SOURCE_DIRECTORY__ + "../../../integrationtests/scenarios")

let update scenario =
let result =
ExecProcessAndReturnMessages (fun info ->
info.FileName <- paketToolPath
info.WorkingDirectory <- Path.Combine(integrationTestPath,scenario)
info.Arguments <- "update") (System.TimeSpan.FromMinutes 1.)
if result.ExitCode <> 0 then
let errors = String.Join(Environment.NewLine,result.Errors)
failwith errors

let updateShouldFindPackageConflict packageName scenario =
try
update scenario
failwith "No conflict was found."
with
| exn when exn.Message.Contains(sprintf "Could not resolve package %s:" packageName) -> ()
6 changes: 6 additions & 0 deletions integrationtests/Paket.IntegrationTests/paket.references
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FSharp.Core

group Test
NUnit
NUnit.Runners.Net4
File:FsUnit.fs .
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
source https://nuget.org/api/v2

nuget FSharp.Formatting
nuget Microsoft.AspNet.SignalR.Core
nuget Microsoft.AspNet.SignalR.JS
nuget Microsoft.Owin.Hosting
nuget Microsoft.Owin.Security.Cookies
nuget Nancy 1.2.0
nuget Nancy.MSOwinSecurity
nuget NUnit
nuget NUnit.Runners
nuget FAKE
nuget SourceLink.Fake
nuget Nancy.Serialization.JsonNet
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source https://nuget.org/api/v2

nuget Microsoft.AspNet.SignalR.JS
nuget Nancy.Serialization.JsonNet
nuget SourceLink.Fake
nuget Ninject.Extensions.Logging.Log4net == 3.2.0
nuget Ninject.Extensions.Interception.Linfu == 2.2.1.2
4 changes: 2 additions & 2 deletions src/Paket.Core/BindingRedirects.fs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ let private getProjectFilesInDirectory folder =
Directory.GetFiles(folder, "*proj")
|> Seq.filter (Path.GetExtension >> isDotNetProject)
let private addConfigFileToProject projectFile =
ProjectFile.Load projectFile
ProjectFile.TryLoad projectFile
|> Option.bind(fun project ->
project.ProjectNode
|> Xml.getNodes "ItemGroup"
Expand All @@ -109,7 +109,7 @@ let private addConfigFileToProject projectFile =
let private applyBindingRedirects bindingRedirects (configFilePath:string) =
let projectFile =
getProjectFilesInDirectory (Path.GetDirectoryName(configFilePath))
|> Seq.map ProjectFile.Load
|> Seq.map ProjectFile.TryLoad
|> Seq.tryHead
|> Option.bind id

Expand Down
4 changes: 2 additions & 2 deletions src/Paket.Core/PackageMetaData.fs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ let loadAssemblyAttributes fileName (assembly:Assembly) =
with
| :? FileNotFoundException ->
// retrieving via path
let assembly = Assembly.LoadFrom fileName
let assembly = Assembly.LoadFrom fileName
assembly.GetCustomAttributes(true)
| exn ->
traceWarnfn "Loading custom attributes failed for %s.%sMessage: %s" fileName Environment.NewLine exn.Message
Expand Down Expand Up @@ -155,7 +155,7 @@ let findDependencies (dependencies : DependenciesFile) config (template : Templa
| Some packagedRef -> packagedRef :: deps, files
| None ->
let p =
match ProjectFile.Load(Path.Combine(projectDir, p.RelativePath) |> normalizePath) with
match ProjectFile.TryLoad(Path.Combine(projectDir, p.RelativePath) |> normalizePath) with
| Some p -> p
| _ -> failwithf "Missing project reference in proj file %s" p.RelativePath

Expand Down
Loading

0 comments on commit 8b00641

Please sign in to comment.