Skip to content

Commit

Permalink
Refactored tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GearsAD committed Mar 28, 2022
1 parent 2b378dc commit ecde4cb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion test/integration/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 6 additions & 7 deletions test/integration/testFactor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
19 changes: 12 additions & 7 deletions test/integration/testSolve.jl
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ecde4cb

Please sign in to comment.