Skip to content

Commit

Permalink
fix bugs, add test for mergeDataEntries
Browse files Browse the repository at this point in the history
  • Loading branch information
dehann committed Nov 2, 2022
1 parent 70aaf40 commit eeab948
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/DataBlobs/services/AbstractDataEntries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ function mergeDataEntries!(
bllb::Union{Symbol, UUID, <:AbstractString, Regex}
)
#
des = getDataEntry(src, slbl, bllb)
_makevec(s) = [s;]
_makevec(s::AbstractVector) = s
des_ = getDataEntry(src, slbl, bllb)
des = _makevec(des_)
# don't add data entries that already exist
dde = listDataEntries(dst, dlbl)
uids = (s->s.id).(dde)
Expand Down
15 changes: 15 additions & 0 deletions test/consol_DataEntryBlobTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,23 @@ ade3,adb3 = updateData!(dfg, :x2, deepcopy(ade))
@test ade == ade2 == ade3
@test adb == adb2 == adb3


@test :random in listDataEntries(dfg, :x2)
@test length(listDataEntries(dfg, :x1)) === 0
@test length(listDataEntries(dfg, :x2)) === 1

mergeDataEntries!(dfg, :x1, dfg, :x2, :random)

@test length(listDataEntries(dfg, :x1)) === 1
@test :random in listDataEntries(dfg, :x1)
@test length(listDataEntries(dfg, :x2)) === 1

deleteData!(dfg, :x1, :random)
deleteData!(dfg, :x2, :random)

@test length(listDataEntries(dfg, :x1)) === 0
@test length(listDataEntries(dfg, :x2)) === 0

##==============================================================================
## FileDataEntry
##==============================================================================
Expand Down

0 comments on commit eeab948

Please sign in to comment.