Skip to content

Commit 73313d0

Browse files
committed
Initial Integration tests - closes #894
1 parent 51eaeb3 commit 73313d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+368
-77
lines changed

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ language: csharp
33
sudo: false # use the new container-based Travis infrastructure
44

55
script:
6-
- ./build.sh All
6+
- ./build.sh RunIntegrationTests

Diff for: Paket.sln

+7
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "commands", "commands", "{44
7777
EndProject
7878
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paket.Bootstrapper.Tests", "tests\Paket.Bootstrapper.Tests\Paket.Bootstrapper.Tests.csproj", "{7C622582-E281-4EAB-AADA-B5893BB89B45}"
7979
EndProject
80+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Paket.IntegrationTests", "integrationtests\Paket.IntegrationTests\Paket.IntegrationTests.fsproj", "{7234B9B4-8CF5-4E68-AA29-050C087B9246}"
81+
EndProject
8082
Global
8183
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8284
Debug|Any CPU = Debug|Any CPU
@@ -103,6 +105,10 @@ Global
103105
{7C622582-E281-4EAB-AADA-B5893BB89B45}.Debug|Any CPU.Build.0 = Debug|Any CPU
104106
{7C622582-E281-4EAB-AADA-B5893BB89B45}.Release|Any CPU.ActiveCfg = Release|Any CPU
105107
{7C622582-E281-4EAB-AADA-B5893BB89B45}.Release|Any CPU.Build.0 = Release|Any CPU
108+
{7234B9B4-8CF5-4E68-AA29-050C087B9246}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
109+
{7234B9B4-8CF5-4E68-AA29-050C087B9246}.Debug|Any CPU.Build.0 = Debug|Any CPU
110+
{7234B9B4-8CF5-4E68-AA29-050C087B9246}.Release|Any CPU.ActiveCfg = Release|Any CPU
111+
{7234B9B4-8CF5-4E68-AA29-050C087B9246}.Release|Any CPU.Build.0 = Release|Any CPU
106112
EndGlobalSection
107113
GlobalSection(SolutionProperties) = preSolution
108114
HideSolutionNode = FALSE
@@ -113,5 +119,6 @@ Global
113119
{E789C72A-5CFD-436B-8EF1-61AA2852A89F} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4}
114120
{4425A246-BD18-4622-86B5-0154F19165E4} = {8E6D5255-776D-4B61-85F9-73C37AA1FB9A}
115121
{7C622582-E281-4EAB-AADA-B5893BB89B45} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4}
122+
{7234B9B4-8CF5-4E68-AA29-050C087B9246} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4}
116123
EndGlobalSection
117124
EndGlobal

Diff for: appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
init:
22
- git config --global core.autocrlf input
33
build_script:
4-
- cmd: build.cmd All
4+
- cmd: build.cmd RunIntegrationTests
55
test: off
66
version: 0.0.1.{build}
77
artifacts:

Diff for: build.fsx

+14-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ let solutionFilePowerShell = "Paket.PowerShell.sln"
4646

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

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

167+
168+
Target "RunIntegrationTests" (fun _ ->
169+
!! integrationTestAssemblies
170+
|> NUnit (fun p ->
171+
{ p with
172+
DisableShadowCopy = true
173+
TimeOut = TimeSpan.FromMinutes 20.
174+
OutputFile = "TestResults.xml" })
175+
)
176+
177+
166178
// --------------------------------------------------------------------------------------
167179
// Build a NuGet package
168180

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

412424
"All"
425+
==> "RunIntegrationTests"
413426
==> "MergePaketTool"
414427
=?> ("MergePowerShell", not isMono)
415428
==> "SignAssemblies"
@@ -431,7 +444,7 @@ Target "All" DoNothing
431444
==> "PublishChocolatey"
432445
==> "PublishNuGet"
433446

434-
"PublishNuGet"
447+
"PublishNuGet"
435448
==> "ReleaseGitHub"
436449
==> "Release"
437450

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace System
2+
open System.Reflection
3+
4+
[<assembly: AssemblyTitleAttribute("Paket.IntegrationTests")>]
5+
[<assembly: AssemblyProductAttribute("Paket")>]
6+
[<assembly: AssemblyDescriptionAttribute("A description")>]
7+
[<assembly: AssemblyCompanyAttribute("Two, Authors")>]
8+
[<assembly: AssemblyVersionAttribute("1.0.0.0")>]
9+
do ()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{7234b9b4-8cf5-4e68-aa29-050c087b9246}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>Paket.Tests</RootNamespace>
11+
<AssemblyName>Paket.IntegrationTests</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<TargetFSharpCoreVersion>4.3.0.0</TargetFSharpCoreVersion>
14+
<Name>Paket.Tests</Name>
15+
<TargetFrameworkProfile />
16+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
17+
<RestorePackages>true</RestorePackages>
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<Tailcalls>false</Tailcalls>
24+
<OutputPath>bin\Debug\</OutputPath>
25+
<DefineConstants>DEBUG;TRACE</DefineConstants>
26+
<WarningLevel>3</WarningLevel>
27+
<DocumentationFile>
28+
</DocumentationFile>
29+
<StartAction>Project</StartAction>
30+
<StartProgram>
31+
</StartProgram>
32+
<StartArguments>
33+
</StartArguments>
34+
</PropertyGroup>
35+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
36+
<DebugType>pdbonly</DebugType>
37+
<Optimize>true</Optimize>
38+
<Tailcalls>true</Tailcalls>
39+
<OutputPath>bin\Release\</OutputPath>
40+
<DefineConstants>TRACE</DefineConstants>
41+
<WarningLevel>3</WarningLevel>
42+
<DocumentationFile>
43+
</DocumentationFile>
44+
</PropertyGroup>
45+
<PropertyGroup>
46+
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
47+
</PropertyGroup>
48+
<Choose>
49+
<When Condition="'$(VisualStudioVersion)' != '11.0' and Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
50+
<PropertyGroup>
51+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
52+
</PropertyGroup>
53+
</When>
54+
<When Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')">
55+
<PropertyGroup>
56+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
57+
</PropertyGroup>
58+
</When>
59+
<When Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
60+
<PropertyGroup>
61+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
62+
</PropertyGroup>
63+
</When>
64+
<When Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\4.0\Framework\v4.0\Microsoft.FSharp.Targets')">
65+
<PropertyGroup>
66+
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\4.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
67+
</PropertyGroup>
68+
</When>
69+
</Choose>
70+
<Import Project="$(FSharpTargetsPath)" />
71+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
72+
Other similar extension points exist, see Microsoft.Common.targets.
73+
<Target Name="BeforeBuild">
74+
</Target>
75+
<Target Name="AfterBuild">
76+
</Target>
77+
-->
78+
<Import Project="$(SolutionDir)\.paket\paket.targets" />
79+
<ItemGroup>
80+
<Compile Include="..\..\paket-files\test\forki\FsUnit\FsUnit.fs">
81+
<Paket>True</Paket>
82+
<Link>FsUnit.fs</Link>
83+
</Compile>
84+
<Compile Include="AssemblyInfo.fs" />
85+
<Compile Include="TestHelper.fs" />
86+
<Compile Include="ResolverSkipsConflictsFastSpecs.fs" />
87+
<None Include="paket.references" />
88+
</ItemGroup>
89+
<ItemGroup>
90+
<Reference Include="FakeLib">
91+
<HintPath>..\..\packages\build\FAKE\tools\FakeLib.dll</HintPath>
92+
</Reference>
93+
<Reference Include="mscorlib" />
94+
<Reference Include="System" />
95+
<Reference Include="System.Numerics" />
96+
<Reference Include="System.Security" />
97+
<Reference Include="System.Xml" />
98+
<Reference Include="System.Xml.Linq" />
99+
</ItemGroup>
100+
<Import Project="Paket.Tests.paket.targets" Condition="Exists('Paket.Tests.paket.targets')" />
101+
<Choose>
102+
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5')">
103+
<ItemGroup>
104+
<Reference Include="FSharp.Core">
105+
<HintPath>..\..\packages\FSharp.Core\lib\net20\FSharp.Core.dll</HintPath>
106+
<Private>True</Private>
107+
<Paket>True</Paket>
108+
</Reference>
109+
</ItemGroup>
110+
</When>
111+
<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')">
112+
<ItemGroup>
113+
<Reference Include="FSharp.Core">
114+
<HintPath>..\..\packages\FSharp.Core\lib\net40\FSharp.Core.dll</HintPath>
115+
<Private>True</Private>
116+
<Paket>True</Paket>
117+
</Reference>
118+
</ItemGroup>
119+
</When>
120+
<When Condition="($(TargetFrameworkIdentifier) == '.NETCore') Or ($(TargetFrameworkIdentifier) == 'Xamarin.Mac') Or ($(TargetFrameworkProfile) == 'Profile7') Or ($(TargetFrameworkProfile) == 'Profile44')">
121+
<ItemGroup>
122+
<Reference Include="FSharp.Core">
123+
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+netcore45\FSharp.Core.dll</HintPath>
124+
<Private>True</Private>
125+
<Paket>True</Paket>
126+
</Reference>
127+
</ItemGroup>
128+
</When>
129+
<When Condition="($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch') Or ($(TargetFrameworkIdentifier) == 'Xamarin.iOS')">
130+
<ItemGroup>
131+
<Reference Include="FSharp.Core">
132+
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll</HintPath>
133+
<Private>True</Private>
134+
<Paket>True</Paket>
135+
</Reference>
136+
</ItemGroup>
137+
</When>
138+
<When Condition="($(TargetFrameworkIdentifier) == 'Silverlight' And $(TargetFrameworkVersion) == 'v5.0') Or ($(TargetFrameworkProfile) == 'Profile24') Or ($(TargetFrameworkProfile) == 'Profile47')">
139+
<ItemGroup>
140+
<Reference Include="FSharp.Core">
141+
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+sl5+netcore45\FSharp.Core.dll</HintPath>
142+
<Private>True</Private>
143+
<Paket>True</Paket>
144+
</Reference>
145+
</ItemGroup>
146+
</When>
147+
<When Condition="($(TargetFrameworkIdentifier) == 'WindowsPhone' And ($(TargetFrameworkVersion) == 'v8.0' Or $(TargetFrameworkVersion) == 'v8.1')) Or ($(TargetFrameworkProfile) == 'Profile31') Or ($(TargetFrameworkProfile) == 'Profile49') Or ($(TargetFrameworkProfile) == 'Profile78')">
148+
<ItemGroup>
149+
<Reference Include="FSharp.Core">
150+
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wp8\FSharp.Core.dll</HintPath>
151+
<Private>True</Private>
152+
<Paket>True</Paket>
153+
</Reference>
154+
</ItemGroup>
155+
</When>
156+
<When Condition="($(TargetFrameworkIdentifier) == 'WindowsPhoneApp') Or ($(TargetFrameworkProfile) == 'Profile32') Or ($(TargetFrameworkProfile) == 'Profile84') Or ($(TargetFrameworkProfile) == 'Profile111') Or ($(TargetFrameworkProfile) == 'Profile151') Or ($(TargetFrameworkProfile) == 'Profile157') Or ($(TargetFrameworkProfile) == 'Profile259')">
157+
<ItemGroup>
158+
<Reference Include="FSharp.Core">
159+
<HintPath>..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wpa81+wp8\FSharp.Core.dll</HintPath>
160+
<Private>True</Private>
161+
<Paket>True</Paket>
162+
</Reference>
163+
</ItemGroup>
164+
</When>
165+
</Choose>
166+
<ItemGroup>
167+
<Reference Include="nunit.framework">
168+
<HintPath>..\..\packages\test\NUnit\lib\nunit.framework.dll</HintPath>
169+
<Private>True</Private>
170+
<Paket>True</Paket>
171+
</Reference>
172+
</ItemGroup>
173+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module Paket.IntegrationTests.ResolverSkipsConflictsFastSpecs
2+
3+
open Fake
4+
open System
5+
open NUnit.Framework
6+
open FsUnit
7+
open System
8+
open System.IO
9+
10+
[<Test>]
11+
let ``#166 Should resolve Nancy without timeount``() =
12+
update "i001166-resolve-nancy-fast"
13+
14+
[<Test>]
15+
let ``#1174 Should find Ninject error``() =
16+
updateShouldFindPackageConflict "Ninject" "i001174-resolve-fast-conflict"
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[<AutoOpen>]
2+
module Paket.IntegrationTests.TestHelpers
3+
4+
open Fake
5+
open System
6+
open NUnit.Framework
7+
open FsUnit
8+
open System
9+
open System.IO
10+
11+
let paketToolPath = FullName(__SOURCE_DIRECTORY__ + "../../../bin/paket.exe")
12+
let integrationTestPath = FullName(__SOURCE_DIRECTORY__ + "../../../integrationtests/scenarios")
13+
14+
let paket command scenario =
15+
let originalScenarioPath = Path.Combine(integrationTestPath,scenario,"before")
16+
let scenarioPath = Path.Combine(integrationTestPath,scenario,"temp")
17+
CleanDir scenarioPath
18+
CopyDir scenarioPath originalScenarioPath (fun _ -> true)
19+
20+
let result =
21+
ExecProcessAndReturnMessages (fun info ->
22+
info.FileName <- paketToolPath
23+
info.WorkingDirectory <- scenarioPath
24+
info.Arguments <- command) (System.TimeSpan.FromMinutes 1.)
25+
if result.ExitCode <> 0 then
26+
let errors = String.Join(Environment.NewLine,result.Errors)
27+
failwith errors
28+
29+
let update scenario = paket "update" scenario
30+
31+
let updateShouldFindPackageConflict packageName scenario =
32+
try
33+
update scenario
34+
failwith "No conflict was found."
35+
with
36+
| exn when exn.Message.Contains(sprintf "Could not resolve package %s:" packageName) -> ()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FSharp.Core
2+
3+
group Test
4+
NUnit
5+
NUnit.Runners.Net4
6+
File:FsUnit.fs .
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
source https://nuget.org/api/v2
2+
3+
nuget FSharp.Formatting
4+
nuget Microsoft.AspNet.SignalR.Core
5+
nuget Microsoft.AspNet.SignalR.JS
6+
nuget Microsoft.Owin.Hosting
7+
nuget Microsoft.Owin.Security.Cookies
8+
nuget Nancy 1.2.0
9+
nuget Nancy.MSOwinSecurity
10+
nuget NUnit
11+
nuget NUnit.Runners
12+
nuget FAKE
13+
nuget SourceLink.Fake
14+
nuget Nancy.Serialization.JsonNet
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
source https://nuget.org/api/v2
2+
3+
nuget Microsoft.AspNet.SignalR.JS
4+
nuget Nancy.Serialization.JsonNet
5+
nuget SourceLink.Fake
6+
nuget Ninject.Extensions.Logging.Log4net == 3.2.0
7+
nuget Ninject.Extensions.Interception.Linfu == 2.2.1.2

Diff for: src/Paket.Core/BindingRedirects.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ let private getProjectFilesInDirectory folder =
9292
Directory.GetFiles(folder, "*proj")
9393
|> Seq.filter (Path.GetExtension >> isDotNetProject)
9494
let private addConfigFileToProject projectFile =
95-
ProjectFile.Load projectFile
95+
ProjectFile.TryLoad projectFile
9696
|> Option.bind(fun project ->
9797
project.ProjectNode
9898
|> Xml.getNodes "ItemGroup"
@@ -109,7 +109,7 @@ let private addConfigFileToProject projectFile =
109109
let private applyBindingRedirects bindingRedirects (configFilePath:string) =
110110
let projectFile =
111111
getProjectFilesInDirectory (Path.GetDirectoryName(configFilePath))
112-
|> Seq.map ProjectFile.Load
112+
|> Seq.map ProjectFile.TryLoad
113113
|> Seq.tryHead
114114
|> Option.bind id
115115

Diff for: src/Paket.Core/PackageMetaData.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ let loadAssemblyAttributes fileName (assembly:Assembly) =
102102
with
103103
| :? FileNotFoundException ->
104104
// retrieving via path
105-
let assembly = Assembly.LoadFrom fileName
105+
let assembly = Assembly.LoadFrom fileName
106106
assembly.GetCustomAttributes(true)
107107
| exn ->
108108
traceWarnfn "Loading custom attributes failed for %s.%sMessage: %s" fileName Environment.NewLine exn.Message
@@ -155,7 +155,7 @@ let findDependencies (dependencies : DependenciesFile) config (template : Templa
155155
| Some packagedRef -> packagedRef :: deps, files
156156
| None ->
157157
let p =
158-
match ProjectFile.Load(Path.Combine(projectDir, p.RelativePath) |> normalizePath) with
158+
match ProjectFile.TryLoad(Path.Combine(projectDir, p.RelativePath) |> normalizePath) with
159159
| Some p -> p
160160
| _ -> failwithf "Missing project reference in proj file %s" p.RelativePath
161161

0 commit comments

Comments
 (0)