[arvados] created: 2.5.0-314-g94fefe0ee

git repository hosting git at public.arvados.org
Fri Mar 31 14:18:19 UTC 2023


        at  94fefe0eee024d4a56f0b6a296ca2ce04e38e464 (commit)


commit 94fefe0eee024d4a56f0b6a296ca2ce04e38e464
Author: Konrad Rudolph <konrad.rudolph at gmail.com>
Date:   Thu Mar 30 19:25:25 2023 +0200

    Add unit test
    
    Arvados-DCO-1.1-Signed-off-by: Konrad Rudolph <konrad.rudolph at gmail.com>

diff --git a/sdk/R/tests/testthat/fakes/FakeRESTService.R b/sdk/R/tests/testthat/fakes/FakeRESTService.R
index 095392661..255e64d1b 100644
--- a/sdk/R/tests/testthat/fakes/FakeRESTService.R
+++ b/sdk/R/tests/testthat/fakes/FakeRESTService.R
@@ -146,7 +146,11 @@ FakeRESTService <- R6::R6Class(
         getCollectionContent = function(uuid, relativePath = NULL)
         {
             self$getCollectionContentCallCount <- self$getCollectionContentCallCount + 1
-            self$collectionContent
+            if (!is.null(relativePath)) {
+                self$collectionContent[startsWith(self$collectionContent, relativePath)]
+            } else {
+                self$collectionContent
+            }
         },
 
         getResourceSize = function(uuid, relativePathToResource)
diff --git a/sdk/R/tests/testthat/test-Collection.R b/sdk/R/tests/testthat/test-Collection.R
index 20a2ecf05..3023a1b23 100644
--- a/sdk/R/tests/testthat/test-Collection.R
+++ b/sdk/R/tests/testthat/test-Collection.R
@@ -239,6 +239,12 @@ test_that("get returns arvados file or subcollection from internal tree structur
 
     expect_true(fishIsNotNull)
     expect_that(fish$getName(), equals("fish"))
+
+    ball <- collection$get("ball")
+    ballIsNotNull <- !is.null(ball)
+
+    expect_true(ballIsNotNull)
+    expect_that(ball$getName(), equals("ball"))
 })
 
 test_that(paste("copy copies content to a new location inside file tree",

commit e0c3829f04a3f72410dafd17e14dd07331111fe3
Author: Konrad Rudolph <konrad.rudolph at gmail.com>
Date:   Thu Mar 30 18:33:15 2023 +0200

    Fix collection tree caching bug
    
    Before this fix, accessing two files inside the same collection in
    succession via `collection$get` will fail on the second file because the
    private tree inside the `collection` is only populated with the relative
    path of the first file.
    
    Arvados-DCO-1.1-Signed-off-by: Konrad Rudolph <konrad.rudolph at gmail.com>

diff --git a/sdk/R/R/Collection.R b/sdk/R/R/Collection.R
index 655bf98b3..14ab0e6f2 100644
--- a/sdk/R/R/Collection.R
+++ b/sdk/R/R/Collection.R
@@ -391,7 +391,7 @@ Collection <- R6::R6Class(
         get = function(relativePath)
         {
             if(is.null(private$tree))
-                private$generateCollectionTreeStructure(relativePath)
+                private$generateCollectionTreeStructure()
 
             private$tree$getElement(relativePath)
         },

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list