зеркало из https://github.com/Azure/AzureStor.git
r cmd check passes
This commit is contained in:
Родитель
c2c1f3a7f0
Коммит
2683134c57
|
@ -3,6 +3,24 @@ make_name <- function(n=20)
|
|||
paste0(sample(letters, n, TRUE), collapse="")
|
||||
}
|
||||
|
||||
write_file <- function(dir, size=1000)
|
||||
{
|
||||
fname <- tempfile(tmpdir=dir)
|
||||
bytes <- openssl::rand_bytes(size)
|
||||
writeBin(bytes, fname)
|
||||
basename(fname)
|
||||
}
|
||||
|
||||
files_identical <- function(set1, set2)
|
||||
{
|
||||
all(mapply(function(f1, f2)
|
||||
{
|
||||
s1 <- file.size(f1)
|
||||
s2 <- file.size(f2)
|
||||
s1 == s2 && identical(readBin(f1, "raw", s1), readBin(f2, "raw", s2))
|
||||
}, set1, set2))
|
||||
}
|
||||
|
||||
# keep core count down for R CMD check
|
||||
multiupload_blob <- function(...)
|
||||
AzureStor::multiupload_blob(..., max_concurrent_transfers=2)
|
||||
|
|
|
@ -19,24 +19,6 @@ stor <- sub$get_resource_group(rgname)$get_storage_account(storname)
|
|||
bl <- stor$get_blob_endpoint()
|
||||
options(azure_storage_progress_bar=FALSE)
|
||||
|
||||
write_file <- function(dir, size=1000)
|
||||
{
|
||||
fname <- tempfile(tmpdir=dir)
|
||||
bytes <- openssl::rand_bytes(size)
|
||||
writeBin(bytes, fname)
|
||||
basename(fname)
|
||||
}
|
||||
|
||||
files_identical <- function(set1, set2)
|
||||
{
|
||||
all(mapply(function(f1, f2)
|
||||
{
|
||||
s1 <- file.size(f1)
|
||||
s2 <- file.size(f2)
|
||||
s1 == s2 && identical(readBin(f1, "raw", s1), readBin(f2, "raw", s2))
|
||||
}, set1, set2))
|
||||
}
|
||||
|
||||
srcdir <- tempfile(pattern="ul")
|
||||
destdir <- tempfile(pattern="dl")
|
||||
destdir2 <- tempfile(pattern="dl")
|
||||
|
@ -144,20 +126,16 @@ test_that("Blob multicopy from URL works",
|
|||
contname <- paste0(sample(letters, 10, TRUE), collapse="")
|
||||
cont <- create_blob_container(bl, contname)
|
||||
|
||||
fnames <- c("LICENSE", "LICENSE.md", "CONTRIBUTING.md")
|
||||
fnames <- c("LICENSE", "DESCRIPTION", "NAMESPACE")
|
||||
src_urls <- paste0("https://raw.githubusercontent.com/Azure/AzureStor/master/", fnames)
|
||||
origs <- normalizePath(paste0("../../", fnames))
|
||||
origs <- replicate(3, tempfile())
|
||||
dests <- replicate(3, tempfile())
|
||||
|
||||
multicopy_url_to_blob(cont, src_urls, fnames, async=FALSE)
|
||||
multidownload_blob(cont, fnames, dests)
|
||||
pool_map(download.file, src_urls, origs, mode="wb")
|
||||
|
||||
# use readLines to workaround GH auto-translating CRLF -> LF
|
||||
expect_true(file.exists(dests))
|
||||
expect_true(all(mapply(function(f1, f2)
|
||||
{
|
||||
identical(readLines(f1), readLines(f2))
|
||||
}, dests, origs)))
|
||||
expect_true(files_identical(origs, dests))
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -19,24 +19,6 @@ stor <- sub$get_resource_group(rgname)$get_storage_account(storname)
|
|||
fl <- stor$get_file_endpoint()
|
||||
options(azure_storage_progress_bar=FALSE)
|
||||
|
||||
write_file <- function(dir, size=1000)
|
||||
{
|
||||
fname <- tempfile(tmpdir=dir)
|
||||
bytes <- openssl::rand_bytes(size)
|
||||
writeBin(bytes, fname)
|
||||
basename(fname)
|
||||
}
|
||||
|
||||
files_identical <- function(set1, set2)
|
||||
{
|
||||
all(mapply(function(f1, f2)
|
||||
{
|
||||
s1 <- file.size(f1)
|
||||
s2 <- file.size(f2)
|
||||
s1 == s2 && identical(readBin(f1, "raw", s1), readBin(f2, "raw", s2))
|
||||
}, set1, set2))
|
||||
}
|
||||
|
||||
srcdir <- tempfile(pattern="ul")
|
||||
destdir <- tempfile(pattern="dl")
|
||||
destdir2 <- tempfile(pattern="dl")
|
||||
|
|
|
@ -19,24 +19,6 @@ stor <- sub$get_resource_group(rgname)$get_storage_account(storname)
|
|||
ad <- stor$get_adls_endpoint()
|
||||
options(azure_storage_progress_bar=FALSE)
|
||||
|
||||
write_file <- function(dir, size=1000)
|
||||
{
|
||||
fname <- tempfile(tmpdir=dir)
|
||||
bytes <- openssl::rand_bytes(size)
|
||||
writeBin(bytes, fname)
|
||||
basename(fname)
|
||||
}
|
||||
|
||||
files_identical <- function(set1, set2)
|
||||
{
|
||||
all(mapply(function(f1, f2)
|
||||
{
|
||||
s1 <- file.size(f1)
|
||||
s2 <- file.size(f2)
|
||||
s1 == s2 && identical(readBin(f1, "raw", s1), readBin(f2, "raw", s2))
|
||||
}, set1, set2))
|
||||
}
|
||||
|
||||
srcdir <- tempfile(pattern="ul")
|
||||
destdir <- tempfile(pattern="dl")
|
||||
destdir2 <- tempfile(pattern="dl")
|
||||
|
|
|
@ -132,29 +132,25 @@ test_that("Blob copy from URL works",
|
|||
|
||||
# copy from GitHub repo
|
||||
src_url <- "https://raw.githubusercontent.com/Azure/AzureStor/master/tests/resources/iris.csv"
|
||||
orig_file <- "../resources/iris.csv"
|
||||
orig_file <- tempfile()
|
||||
new_file <- tempfile()
|
||||
|
||||
copy_url_to_storage(cont, src_url, "iris.csv", async=FALSE)
|
||||
storage_download(cont, "iris.csv", new_file)
|
||||
download.file(src_url, orig_file, mode="wb", quiet=TRUE)
|
||||
|
||||
# use readLines to workaround GH auto-translating CRLF -> LF
|
||||
expect_identical(readLines(orig_file), readLines(new_file))
|
||||
expect_true(files_identical(orig_file, new_file))
|
||||
|
||||
fnames <- c("LICENSE", "LICENSE.md", "CONTRIBUTING.md")
|
||||
fnames <- c("LICENSE", "DESCRIPTION", "NAMESPACE")
|
||||
src_urls <- paste0("https://raw.githubusercontent.com/Azure/AzureStor/master/", fnames)
|
||||
origs <- paste0("../../", fnames)
|
||||
dests <- c(tempfile(), tempfile(), tempfile())
|
||||
origs <- replicate(3, tempfile())
|
||||
dests <- replicate(3, tempfile())
|
||||
|
||||
multicopy_url_to_storage(cont, src_urls, fnames, async=FALSE)
|
||||
storage_multidownload(cont, fnames, dests)
|
||||
pool_map(download.file, src_urls, origs, mode="wb")
|
||||
|
||||
# use readLines to workaround GH auto-translating CRLF -> LF
|
||||
expect_true(file.exists(dests))
|
||||
expect_true(all(mapply(function(f1, f2)
|
||||
{
|
||||
identical(readLines(f1), readLines(f2))
|
||||
}, dests, origs)))
|
||||
expect_true(files_identical(origs, dests))
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -19,24 +19,6 @@ stor <- sub$get_resource_group(rgname)$get_storage_account(storname)
|
|||
bl <- stor$get_blob_endpoint()
|
||||
options(azure_storage_progress_bar=FALSE)
|
||||
|
||||
write_file <- function(dir, size=1000)
|
||||
{
|
||||
fname <- tempfile(tmpdir=dir)
|
||||
bytes <- openssl::rand_bytes(size)
|
||||
writeBin(bytes, fname)
|
||||
basename(fname)
|
||||
}
|
||||
|
||||
files_identical <- function(set1, set2)
|
||||
{
|
||||
all(mapply(function(f1, f2)
|
||||
{
|
||||
s1 <- file.size(f1)
|
||||
s2 <- file.size(f2)
|
||||
s1 == s2 && identical(readBin(f1, "raw", s1), readBin(f2, "raw", s2))
|
||||
}, set1, set2))
|
||||
}
|
||||
|
||||
srcdir <- tempfile(pattern="ul")
|
||||
destdir <- tempfile(pattern="dl")
|
||||
destdir2 <- tempfile(pattern="dl")
|
||||
|
|
|
@ -19,24 +19,6 @@ stor <- sub$get_resource_group(rgname)$get_storage_account(storname)
|
|||
ad <- stor$get_adls_endpoint()
|
||||
options(azure_storage_progress_bar=FALSE)
|
||||
|
||||
write_file <- function(dir, size=1000)
|
||||
{
|
||||
fname <- tempfile(tmpdir=dir)
|
||||
bytes <- openssl::rand_bytes(size)
|
||||
writeBin(bytes, fname)
|
||||
basename(fname)
|
||||
}
|
||||
|
||||
files_identical <- function(set1, set2)
|
||||
{
|
||||
all(mapply(function(f1, f2)
|
||||
{
|
||||
s1 <- file.size(f1)
|
||||
s2 <- file.size(f2)
|
||||
s1 == s2 && identical(readBin(f1, "raw", s1), readBin(f2, "raw", s2))
|
||||
}, set1, set2))
|
||||
}
|
||||
|
||||
srcdir <- tempfile(pattern="ul")
|
||||
destdir <- tempfile(pattern="dl")
|
||||
destdir2 <- tempfile(pattern="dl")
|
||||
|
|
|
@ -42,16 +42,6 @@ ad_key <- stor$get_adls_endpoint(key=key, sas=NULL, token=NULL)
|
|||
|
||||
options(azure_storage_progress_bar=FALSE)
|
||||
|
||||
files_identical <- function(set1, set2)
|
||||
{
|
||||
all(mapply(function(f1, f2)
|
||||
{
|
||||
s1 <- file.size(f1)
|
||||
s2 <- file.size(f2)
|
||||
s1 == s2 && identical(readBin(f1, "raw", s1), readBin(f2, "raw", s2))
|
||||
}, set1, set2))
|
||||
}
|
||||
|
||||
|
||||
test_that("call_azcopy works",
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче