Skip to content

Commit 18c7f3c

Browse files
committed
Adding data tests
1 parent 373b83b commit 18c7f3c

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ function getVariable(dfg::CloudGraphsDFG, label::Union{Symbol, String})
243243
for (k,v) in dataDict
244244
variable.dataDict[k] = v
245245
end
246-
# TODO - data entries
247246

248247
return variable
249248
end

test/interfaceTests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ end
118118
else
119119
@test_skip DataEntriesTestBlock!(fg1, var2)
120120
end
121+
122+
# New data blob API
123+
blobsTestBlock!(fg1, var2)
121124
end
122125

123126
@testset "TODO Sorteer groep" begin

test/testBlocks.jl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,46 @@ function DataEntriesTestBlock!(fg, v2)
864864
@test listDataEntries(v1) == Symbol[]
865865
end
866866

867+
function blobsTestBlock!(fg, v1)
868+
@testset "Data blob tests" begin
869+
# Blobstore functions
870+
fs = FolderStore("/tmp/$(string(uuid4())[1:8])")
871+
# Adding
872+
addBlobStore!(fg, fs)
873+
# Listing
874+
@test listBlobStores(fg) == [fs.key]
875+
# Getting
876+
@test getBlobStore(fg, fs.key) == fs
877+
# Deleting
878+
@test deleteBlobStore!(fg, fs.key) == fs
879+
# Updating
880+
updateBlobStore!(fg, fs)
881+
@test listBlobStores(fg) == [fs.key]
882+
# Emptying
883+
emptyBlobStore!(fg)
884+
@test listBlobStores(fg) == []
885+
# Add it back
886+
addBlobStore!(fg, fs)
887+
888+
# Data functions
889+
testData = rand(UInt8, 50)
890+
# Adding
891+
newData = addData!(fg, fs.key, getLabel(v1), :testing, testData)
892+
# Listing
893+
@test :testing in listDataEntries(fg, getLabel(v1))
894+
# Getting
895+
data = getData(fg, fs, getLabel(v1), :testing)
896+
@test data[1].hash == newData[1].hash
897+
@test data[2] == newData[2]
898+
# Updating
899+
updateData = updateData!(fg, fs, getLabel(v1), newData[1], rand(UInt8, 50))
900+
@test updateData[1].hash != data[1].hash
901+
@test updateData[2] != data[2]
902+
# Deleting
903+
retData = deleteData!(fg, getLabel(v1), :testing)
904+
end
905+
end
906+
867907

868908
function testGroup!(fg, v1, v2, f0, f1)
869909
# "TODO Sorteer groep"

0 commit comments

Comments
 (0)