diff --git a/DESCRIPTION b/DESCRIPTION index 17ef0bbe3..111ff7f38 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,7 +26,6 @@ Depends: R (>= 3.2.0) Imports: arrow, - base64enc, crayon, digest, filelock, @@ -44,20 +43,15 @@ Imports: yaml, zip Suggests: - callr, - covr, - data.table, datasets, + data.table, knitr, R.utils, - R6, rmarkdown, rsconnect, shiny, - stringi, testthat (>= 3.0.0), - tibble, - xml2 + tibble VignetteBuilder: knitr Config/testthat/edition: 3 diff --git a/R/board_azure.R b/R/board_azure.R index a6dcb96b3..bec773d75 100644 --- a/R/board_azure.R +++ b/R/board_azure.R @@ -90,8 +90,8 @@ azure_headers <- function(board, verb, path, file) { sep = "\n" ) - signature <- openssl::sha256(charToRaw(content), key = base64enc::base64decode(board$key)) %>% - base64enc::base64encode() + signature <- openssl::sha256(charToRaw(content), key = jsonlite::base64_dec(board$key)) %>% + jsonlite::base64_enc() headers <- httr::add_headers( `x-ms-date` = date, diff --git a/R/board_dospaces.R b/R/board_dospaces.R index 133c287e2..0543f714b 100644 --- a/R/board_dospaces.R +++ b/R/board_dospaces.R @@ -74,7 +74,7 @@ dospace_headers <- function(board, verb, path, file) { ) signature <- openssl::sha1(charToRaw(content), key = board$secret) %>% - base64enc::base64encode() + jsonlite::base64_enc() headers <- httr::add_headers( Host = paste0(space, ".", board$datacenter, ".", board$host), diff --git a/R/board_github.R b/R/board_github.R index d5eb90c23..9d5ff298b 100644 --- a/R/board_github.R +++ b/R/board_github.R @@ -120,7 +120,7 @@ github_update_temp_index <- function(board, path, commit, operation, name = NULL # API returns contents when size < 1mb if (!is.null(content$content)) { - index <- board_manifest_load(rawToChar(base64enc::base64decode(content$content))) + index <- board_manifest_load(rawToChar(jsonlite::base64_dec(content$content))) } else { response <- httr::GET(content$download_url, github_headers(board)) @@ -169,7 +169,7 @@ github_update_index <- function(board, path, commit, operation, name = NULL, met file_url <- github_url(board, branch = branch, "/contents/", board$path, "data.txt") - base64 <- base64enc::base64encode(index_file) + base64 <- jsonlite::base64_enc(index_file) response <- httr::PUT(file_url, body = list( message = commit, @@ -257,7 +257,7 @@ github_upload_content <- function(board, name, file, file_path, commit, sha, bra file_url <- github_url(board, branch = branch, "/contents/", board$path, name, "/", file) pin_log("uploading ", file_url) - base64 <- base64enc::base64encode(file_path) + base64 <- jsonlite::base64_enc(file_path) response <- httr::PUT(file_url, body = list( message = commit, @@ -280,7 +280,7 @@ github_upload_blob <- function(board, file, file_path, commit) { blob_url <- github_url(board, branch = NULL, "/git/blobs") pin_log("uploading ", file) - base64 <- base64enc::base64encode(file_path) + base64 <- jsonlite::base64_enc(file_path) response <- httr::POST(blob_url, body = list( content = base64, @@ -502,7 +502,7 @@ board_pin_find.pins_board_github <- function(board, text, ...) { content <- httr::content(result, encoding = "UTF-8") } else { - content <- rawToChar(base64enc::base64decode(content$content)) + content <- rawToChar(jsonlite::base64_dec(content$content)) } result <- board_manifest_load(content) %>% diff --git a/R/board_s3.R b/R/board_s3.R index 3417d52aa..96a9bc655 100644 --- a/R/board_s3.R +++ b/R/board_s3.R @@ -192,7 +192,7 @@ s3_headers <- function(board, verb, path, file) { ) signature <- openssl::sha1(charToRaw(content), key = board$secret) %>% - base64enc::base64encode() + jsonlite::base64_enc() headers <- httr::add_headers( Host = paste0(bucket, ".", board$host), diff --git a/tests/testthat/test-board-azure.R b/tests/testthat/test-board-azure.R index 6fcb41ad4..41ba47c7c 100644 --- a/tests/testthat/test-board-azure.R +++ b/tests/testthat/test-board-azure.R @@ -1,5 +1,5 @@ test_that("board contains proper azure headers", { - mock_board <- list(key = base64enc::base64encode(as.raw(1:3)), url = "https://foo.com") + mock_board <- list(key = jsonlite::base64_enc(as.raw(1:3)), url = "https://foo.com") headers <- names(azure_headers(mock_board, "PUT", "x", "files/hello.txt")$headers) expect_true("x-ms-date" %in% headers) diff --git a/tests/testthat/test-pin_registry.R b/tests/testthat/test-pin_registry.R index 9a7dc7fa7..18a79d8e0 100644 --- a/tests/testthat/test-pin_registry.R +++ b/tests/testthat/test-pin_registry.R @@ -30,41 +30,3 @@ test_that("can access entries", { pin_registry_update(board, "x", list(test = "x")) expect_equal(pin_registry_retrieve(board, "x"), list(test = "x", name = "x")) }) - -test_that("can pin() concurrently", { - # BEWARE: this tests the INSTALLED versions of pins - skip_on_ci() - # This fails on CI in a way that I can not replicate locally, even when I - # make n_proc and n_pins substantially larger. I've skipped it because - # I don't think multi-process race conditions are likely to be a problem - # in real-life. - - temp_path <- withr::local_tempdir() - board <- board_folder(temp_path) - - n_proc <- 10 - n_pins <- 10 - - pin_n <- function(path, proc, n_pins) { - board <- pins::board_folder(path) - data <- list(message = "concurrent test") - for (i in seq_len(n_pins)) { - pins::pin(data, name = as.character(proc * 100 + i), board = board) - } - } - - processes <- list() - for (i in seq_len(n_proc)) { - processes[[i]] <- callr::r_bg(pin_n, list( - path = temp_path, - proc = i, - n_pins = n_pins - )) - } - for (i in seq_len(n_proc)) { - processes[[i]]$wait() - } - - index <- pin_registry_read(board) - expect_equal(length(index), n_proc * n_pins) -})