From ecde4cb35790aafb581f209c6f06ab5d14bcf0cb Mon Sep 17 00:00:00 2001 From: Sam Claassens Date: Mon, 28 Mar 2022 07:31:43 -0500 Subject: [PATCH] Refactored tests --- test/integration/runtests.jl | 2 +- test/integration/testFactor.jl | 13 ++++++------- test/integration/testSolve.jl | 19 ++++++++++++------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/test/integration/runtests.jl b/test/integration/runtests.jl index 22cd642..b67134a 100644 --- a/test/integration/runtests.jl +++ b/test/integration/runtests.jl @@ -24,5 +24,5 @@ sessionId2d = get(ENV,"SESSION_ID","TestSession2D"*randstring(7)) # integration test. runVariableTests(client, navabilityClient2D) runFactorTests(client, navabilityClient2D) - # runSolverTests(client, navabilityClient2D) + runSolveTests(client, navabilityClient2D) end diff --git a/test/integration/testFactor.jl b/test/integration/testFactor.jl index d6bd020..8697648 100644 --- a/test/integration/testFactor.jl +++ b/test/integration/testFactor.jl @@ -6,13 +6,12 @@ function testAddFactor(client, context, factorLabels, factorTypes, factorVariabl @test resultId != "Error" push!(resultIds, resultId) end - + waitForCompletion(client, resultIds, expectedStatuses=["Complete"]) return resultIds end function testLsf(client, context, factorLabels, factorTypes) - @show setdiff(factorLabels, lsf(client, context)) @test setdiff(factorLabels, lsf(client, context)) == [] end @@ -28,7 +27,7 @@ function testGetFactors(client, context, factorLabels, factorTypes) # Make a quick dictionary of the expected variable Types factorIdType = Dict(factorLabels .=> factorTypes) - factors = getFactors(client, context; detail=SUMMARY) + factors = getFactors(client, context, detail=FULL) for f in factors @test f["fnctype"] == factorIdType[f["label"]] end @@ -44,9 +43,9 @@ function runFactorTests(client, context) factorVariables = [["x0", "x1"], ["x0"]] factorData = [Pose2Pose2Data(), PriorPose2Data()] - @test testAddFactor(client, context, factorLabels, factorTypes, factorVariables, factorData) - @test testLsf(client, context, factorLabels, factorTypes) - @test testGetFactor(client, context, factorLabels, factorTypes) - @test testGetFactors(client, context, factorLabels, factorTypes) + @testset "Adding" begin testAddFactor(client, context, factorLabels, factorTypes, factorVariables, factorData) end + @testset "Listing" begin testLsf(client, context, factorLabels, factorTypes) end + @testset "Getting" begin testGetFactor(client, context, factorLabels, factorTypes) end + @testset "Getting Lists" begin testGetFactors(client, context, factorLabels, factorTypes) end end end \ No newline at end of file diff --git a/test/integration/testSolve.jl b/test/integration/testSolve.jl index 6318de2..50582d8 100644 --- a/test/integration/testSolve.jl +++ b/test/integration/testSolve.jl @@ -1,22 +1,27 @@ -MAX_POLLING_TRIES = 150 -function testSolveSession(client, context) - testVariableLabels = ls(client, context) +function testSolveSession(client, context, variableLabels) + # allVariableLabels = ls(client, context, variableLabels) resultId = solveSession(client,context) # Wait for them to be done before proceeding. waitForCompletion(client, [resultId], expectedStatuses=["Complete"]) - # Get PPE's to confirm all is there. - # This'll blow up if not. - Dict((vId=>getVariable(client, context, vId; detail=SUMMARY)["ppes"]["default"]) for vId in testVariableLabels) + # Get PPE's are there for the connected variables. + # TODO - complete the factor graph. + for v in variableLabels # getVariables(client, context, detail=SUMMARY) + # First solve key (only) is the default result + @test getVariable(client, context, v)["ppes"][1]["solveKey"] == "default" + end end function runSolveTests(client, context) @testset "solve-testset" begin @info "Running solve-testset" - @test testSolveSession(client, context) + # TODO: Test the rest of the variables. + variableLabels = ["x0", "x1"] + + testSolveSession(client, context, variableLabels) end end