From b10ddffe26c59c34df14290512b242ded2a7c10d Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Thu, 29 Oct 2015 13:54:53 +0100 Subject: [PATCH] "Paket init" Integration tests - references #1040 --- build.fsx | 2 ++ .../Paket.IntegrationTests/InitSpecs.fs | 18 ++++++++++++++++++ .../Paket.IntegrationTests.fsproj | 1 + .../ResolverSkipsConflictsFastSpecs.fs | 2 +- .../Paket.IntegrationTests/TestHelper.fs | 3 ++- .../before/empty.txt | 0 src/Paket.Core/Environment.fs | 4 ++-- src/Paket/Paket.fsproj | 4 ++-- 8 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 integrationtests/Paket.IntegrationTests/InitSpecs.fs create mode 100644 integrationtests/scenarios/i001040-init-downloads-bootstrapper/before/empty.txt diff --git a/build.fsx b/build.fsx index e67ae6bf9f..ed195a9d79 100644 --- a/build.fsx +++ b/build.fsx @@ -160,6 +160,7 @@ Target "RunTests" (fun _ -> |> NUnit (fun p -> { p with DisableShadowCopy = true + ToolPath = "packages/test/NUnit.Runners.Net4/tools" TimeOut = TimeSpan.FromMinutes 20. OutputFile = "TestResults.xml" }) ) @@ -170,6 +171,7 @@ Target "RunIntegrationTests" (fun _ -> |> NUnit (fun p -> { p with DisableShadowCopy = true + ToolPath = "packages/test/NUnit.Runners.Net4/tools" TimeOut = TimeSpan.FromMinutes 20. OutputFile = "TestResults.xml" }) ) diff --git a/integrationtests/Paket.IntegrationTests/InitSpecs.fs b/integrationtests/Paket.IntegrationTests/InitSpecs.fs new file mode 100644 index 0000000000..28e75dbe3a --- /dev/null +++ b/integrationtests/Paket.IntegrationTests/InitSpecs.fs @@ -0,0 +1,18 @@ +module Paket.IntegrationTests.InitSpecs + +open Fake +open System +open NUnit.Framework +open FsUnit +open System +open System.IO +open System.Diagnostics + +[] +let ``#1040 init should download release version of bootstrapper``() = + paket "init" "i001040-init-downloads-bootstrapper" + let bootstrapperpath = Path.Combine(scenarioTempPath "i001040-init-downloads-bootstrapper",".paket","paket.bootstrapper.exe") + + let productVersion = FileVersionInfo.GetVersionInfo(bootstrapperpath).ToString() + String.IsNullOrWhiteSpace productVersion |> shouldEqual false + productVersion.Contains("-") |> shouldEqual false \ No newline at end of file diff --git a/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj b/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj index 55be498988..51b04c1c79 100644 --- a/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj +++ b/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj @@ -83,6 +83,7 @@ + diff --git a/integrationtests/Paket.IntegrationTests/ResolverSkipsConflictsFastSpecs.fs b/integrationtests/Paket.IntegrationTests/ResolverSkipsConflictsFastSpecs.fs index f86309beb8..c79e9b7c96 100644 --- a/integrationtests/Paket.IntegrationTests/ResolverSkipsConflictsFastSpecs.fs +++ b/integrationtests/Paket.IntegrationTests/ResolverSkipsConflictsFastSpecs.fs @@ -8,7 +8,7 @@ open System open System.IO [] -let ``#166 Should resolve Nancy without timeount``() = +let ``#1166 Should resolve Nancy without timeount``() = update "i001166-resolve-nancy-fast" [] diff --git a/integrationtests/Paket.IntegrationTests/TestHelper.fs b/integrationtests/Paket.IntegrationTests/TestHelper.fs index 6f51445a26..017ca02b20 100644 --- a/integrationtests/Paket.IntegrationTests/TestHelper.fs +++ b/integrationtests/Paket.IntegrationTests/TestHelper.fs @@ -10,10 +10,11 @@ open System.IO let paketToolPath = FullName(__SOURCE_DIRECTORY__ + "../../../bin/paket.exe") let integrationTestPath = FullName(__SOURCE_DIRECTORY__ + "../../../integrationtests/scenarios") +let scenarioTempPath scenario = Path.Combine(integrationTestPath,scenario,"temp") let paket command scenario = let originalScenarioPath = Path.Combine(integrationTestPath,scenario,"before") - let scenarioPath = Path.Combine(integrationTestPath,scenario,"temp") + let scenarioPath = scenarioTempPath scenario CleanDir scenarioPath CopyDir scenarioPath originalScenarioPath (fun _ -> true) diff --git a/integrationtests/scenarios/i001040-init-downloads-bootstrapper/before/empty.txt b/integrationtests/scenarios/i001040-init-downloads-bootstrapper/before/empty.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Paket.Core/Environment.fs b/src/Paket.Core/Environment.fs index 30beec6b94..401887871b 100644 --- a/src/Paket.Core/Environment.fs +++ b/src/Paket.Core/Environment.fs @@ -83,10 +83,10 @@ module PaketEnv = let init (directory : DirectoryInfo) = match locatePaketRootDirectory directory with - | Some rootDirectory -> + | Some rootDirectory when rootDirectory.FullName = directory.FullName -> Logging.tracefn "Paket is already initialized in %s" rootDirectory.FullName ok () - | None -> + | _ -> let sources = [PackageSources.DefaultNugetSource] let serialized = (sources diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index e7cee1a0d9..ccd7decbff 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -37,7 +37,7 @@ update group Build pack output D:\code\paketbug\output install - update -f + init Project paket.exe c:\code\Paketkopie @@ -45,7 +45,7 @@ d:\code\paketkopie d:\code\paketbug d:\code\paketrepro - D:\code\paketbug + D:\code\Paket\integrationtests\scenarios\i001040-init-downloads-bootstrapper\temp pdbonly