[ARVADOS-WORKBENCH2] created: 2.1.0-126-g09a02c42

Git user git at public.arvados.org
Sat Dec 5 02:59:42 UTC 2020


        at  09a02c42b441f2191641649e5193ea0a39a35e58 (commit)


commit 09a02c42b441f2191641649e5193ea0a39a35e58
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Fri Dec 4 18:41:11 2020 -0300

    17152: Adjusts cypress integration tests.
    
    * Changes arvados' config disabling the collection idle versioning feature.
    * Fixes one test that required versioning when updating via API calls.
    
    The rest of the versioning tests continue to work because of the updates made
    on workbench2.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/cypress/integration/collection-panel.spec.js b/cypress/integration/collection-panel.spec.js
index 980c5505..23ba682e 100644
--- a/cypress/integration/collection-panel.spec.js
+++ b/cypress/integration/collection-panel.spec.js
@@ -269,6 +269,7 @@ describe('Collection panel tests', function() {
         cy.createCollection(adminUser.token, {
             name: colName,
             owner_uuid: activeUser.user.uuid,
+            preserve_version: true,
             manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
         .as('originalVersion').then(function() {
             // Change the file name to create a new version.
@@ -309,6 +310,7 @@ describe('Collection panel tests', function() {
         cy.createCollection(adminUser.token, {
             name: colName,
             owner_uuid: activeUser.user.uuid,
+            preserve_version: true,
             manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo 0:3:bar\n"})
         .as('collection').then(function() {
             // Visit collection, check basic information
diff --git a/cypress/integration/search.spec.js b/cypress/integration/search.spec.js
index 60292aa5..06131a2e 100644
--- a/cypress/integration/search.spec.js
+++ b/cypress/integration/search.spec.js
@@ -46,6 +46,7 @@ describe('Search tests', function() {
         cy.createCollection(adminUser.token, {
             name: colName,
             owner_uuid: activeUser.user.uuid,
+            preserve_version: true,
             manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
         .as('originalVersion').then(function() {
             // Change the file name to create a new version.
diff --git a/tools/arvados_config.yml b/tools/arvados_config.yml
index b533156d..d93ec7ae 100644
--- a/tools/arvados_config.yml
+++ b/tools/arvados_config.yml
@@ -8,7 +8,7 @@ Clusters:
       Insecure: true
     Collections:
       CollectionVersioning: true
-      PreserveVersionIfIdle: 0s
+      PreserveVersionIfIdle: -1s
       BlobSigningKey: zfhgfenhffzltr9dixws36j1yhksjoll2grmku38mi7yxd66h5j4q9w4jzanezacp8s6q0ro3hxakfye02152hncy6zml2ed0uc
       TrustAllContent: true
       ForwardSlashNameSubstitution: /

commit 57cdabb27166c3921f8775fff8f488c7f299aafc
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Dec 3 18:58:22 2020 -0300

    17152: Adjusts the collection service methods to preserve versions.
    
    As the create() method sets preserve_version to true, it's better
    to re-set it to true after each update, so that the modified_at timestamp
    of the previous version doesn't change.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/src/services/collection-service/collection-service.ts b/src/services/collection-service/collection-service.ts
index 0aa0aa84..3280d05e 100644
--- a/src/services/collection-service/collection-service.ts
+++ b/src/services/collection-service/collection-service.ts
@@ -27,6 +27,18 @@ export class CollectionService extends TrashableResourceService<CollectionResour
         ]);
     }
 
+    create(data?: Partial<CollectionResource>) {
+        return super.create({ ...data, preserveVersion: true });
+    }
+
+    async update(uuid: string, data: Partial<CollectionResource>) {
+        // First make the changes
+        const collection = await super.update(uuid, data);
+        if (data === { preserveVersion: true }) { return collection; }
+        // Then set the head version to be preserved
+        return await super.update(uuid, { preserveVersion: true });
+    }
+
     async files(uuid: string) {
         const request = await this.webdavClient.propfind(`c=${uuid}`);
         if (request.responseXML != null) {
@@ -36,6 +48,7 @@ export class CollectionService extends TrashableResourceService<CollectionResour
     }
 
     async deleteFiles(collectionUuid: string, filePaths: string[]) {
+        if (collectionUuid === "" || filePaths.length === 0) { return; }
         for (const path of filePaths) {
             const splittedPath = path.split('/');
             if (collectionUuid) {
@@ -44,20 +57,24 @@ export class CollectionService extends TrashableResourceService<CollectionResour
                 await this.webdavClient.delete(`c=${collectionUuid}${path}`);
             }
         }
+        await this.update(collectionUuid, { preserveVersion: true });
     }
 
     async uploadFiles(collectionUuid: string, files: File[], onProgress?: UploadProgress) {
+        if (collectionUuid === "" || files.length === 0) { return; }
         // files have to be uploaded sequentially
         for (let idx = 0; idx < files.length; idx++) {
             await this.uploadFile(collectionUuid, files[idx], idx, onProgress);
         }
+        await this.update(collectionUuid, { preserveVersion: true });
     }
 
-    moveFile(collectionUuid: string, oldPath: string, newPath: string) {
-        return this.webdavClient.move(
+    async moveFile(collectionUuid: string, oldPath: string, newPath: string) {
+        await this.webdavClient.move(
             `c=${collectionUuid}${oldPath}`,
             `c=${collectionUuid}${encodeURI(newPath)}`
         );
+        return await this.update(collectionUuid, { preserveVersion: true });
     }
 
     extendFileURL = (file: CollectionDirectory | CollectionFile) => {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list