Skip to content

Commit

Permalink
tests: load target
Browse files Browse the repository at this point in the history
  • Loading branch information
ademar committed Mar 16, 2023
1 parent 4c9e1cd commit 8efe4b3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
source .env
dotnet tool restore
dotnet paket restore
dotnet run --project ./build/build.fsproj -- -t Tests
dotnet run --project ./build/build.fsproj -- -t Load
11 changes: 10 additions & 1 deletion build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ let initTargets () =
res.Errors |> Seq.iter (eprintfn "%s")
failwith "Tests failed."

// Requires `httperf` installed on the server (only linux atm)
Target.create "Load" <| fun _ ->
let path = "examples" </> "Pong"
let res = DotNet.exec id "run" (sprintf "-c Release --framework net7.0 --project %s" path)
if not res.OK then
res.Errors |> Seq.iter (eprintfn "%s")
failwith "Tests failed."

Target.create "Pack" <| fun _ ->
let pkg = Path.GetFullPath "./pkg"
let props (project: string) (p: Paket.PaketPackParams) =
Expand Down Expand Up @@ -108,6 +116,7 @@ let initTargets () =
==> "AsmInfo"
==> "Build"
==> "Tests"
==> "Load"
==> "Pack"
==> "Release"

Expand All @@ -119,5 +128,5 @@ let main argv =
|> Context.RuntimeContext.Fake
|> Context.setExecutionContext
initTargets ()
Target.runOrDefault "Tests"
Target.runOrDefault "Load"
0
4 changes: 2 additions & 2 deletions examples/Pong/Program.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Pong.Program
module Pong.Program

open Suave
open Suave.Successful
Expand Down Expand Up @@ -45,7 +45,7 @@ let main argv =
listening |> Async.RunSynchronously |> printfn "start stats: %A"

// launch httperf
let output = execute "httperf" (sprintf "--hog --server=localhost --port=%d --uri=/ --rate=1000 --num-conns=1000 --num-calls=1000 --burst-length=20" port)
let output = execute "httperf" (sprintf "--hog --server=localhost --port=%d --uri=/ --rate=100 --num-conns=1000 --num-calls=1000 --burst-length=20" port)

Console.WriteLine output

Expand Down

0 comments on commit 8efe4b3

Please sign in to comment.