Skip to content

Commit

Permalink
Update metadata on push
Browse files Browse the repository at this point in the history
  • Loading branch information
richfitz committed Oct 23, 2024
1 parent 5db184a commit 7b2596e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions R/location.R
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ orderly_location_push <- function(expr, location, name = NULL, dry_run = FALSE,
driver <- location_driver(location_name, root)
location_push_files(plan$files, driver, root)
location_push_metadata(plan$packet_id, driver, root)
orderly_location_pull_metadata(location_name, root)
}
}

Expand Down
22 changes: 18 additions & 4 deletions tests/testthat/test-location-path.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ test_that("Import complete tree via push into server", {

expect_equal(idx_s$metadata, idx_c$metadata)
expect_equal(idx_s$unpacked, idx_c$unpacked)
expect_equal(idx_s$location$packet, idx_c$location$packet)
expect_equal(idx_s$location$hash, idx_c$location$hash)
expect_equal(idx_s$location$packet, idx_c$unpacked)
expect_setequal(idx_s$location$hash, idx_c$location$hash)

expect_setequal(plan$packet_id, ids)
files_used <- lapply(ids, function(id) client$index$metadata(id)$files$hash)
Expand Down Expand Up @@ -304,8 +304,8 @@ test_that("Push single packet", {

expect_equal(idx_s$metadata, idx_c$metadata)
expect_equal(idx_s$unpacked, idx_c$unpacked)
expect_equal(idx_s$location$packet, idx_c$location$packet)
expect_equal(idx_s$location$hash, idx_c$location$hash)
expect_equal(idx_s$location$packet, idx_c$unpacked)
expect_setequal(idx_s$location$hash, idx_c$location$hash)

expect_equal(plan$packet_id, id)
files_used <- lapply(id, function(id) client$index$metadata(id)$files$hash)
Expand Down Expand Up @@ -407,3 +407,17 @@ test_that("prevent pushing unknown packets", {
orderly_location_push("20241023-131946-0260c975", "server", root = client),
"Trying to push unknown packet: '20241023-131946-0260c975'")
})


test_that("pull metadata after push", {
client <- create_temporary_root()
id1 <- create_random_packet(client, parameters = list(a = 1))
id2 <- create_random_packet(client, parameters = list(a = 2))
id3 <- create_random_packet(client, parameters = list(a = 1))

server <- create_temporary_root(use_file_store = TRUE, path_archive = NULL)
orderly_location_add_path("server", path = server$path, root = client)

plan <- orderly_location_push("parameter:a == 1", "server", root = client)
expect_length(orderly_search(location = "server", root = client), 2)
})

0 comments on commit 7b2596e

Please sign in to comment.