[ARVADOS-WORKBENCH2] updated: 2.1.0-15-gfeeed01f

Git user git at public.arvados.org
Thu Oct 15 18:27:37 UTC 2020


Summary of changes:
 .licenseignore                                     |  1 +
 cypress/integration/collection-panel.spec.js       | 53 +++++++++++++-
 cypress/integration/search.spec.js                 | 83 ++++++++++++++++++++++
 cypress/support/commands.js                        | 18 +++++
 .../search-bar/search-bar-view.tsx                 |  1 +
 .../search-results-panel-view.tsx                  |  4 +-
 tools/arvados_config.yml                           |  2 +
 7 files changed, 159 insertions(+), 3 deletions(-)
 create mode 100644 cypress/integration/search.spec.js

       via  feeed01f85f60a8989b32ca463b7191d0ad9bb75 (commit)
       via  96626db04a7dcb11b21d92203a6ddd81577191bf (commit)
       via  8516425bd1c541476dc2d5cb00a762691cd753e1 (commit)
      from  7710b036f9a53ad87273b8b760ced5ee98a304fe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit feeed01f85f60a8989b32ca463b7191d0ad9bb75
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Oct 15 15:26:59 2020 -0300

    16719: Ignores integration test config file's lack of license.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/.licenseignore b/.licenseignore
index 7ac3c836..853135fc 100644
--- a/.licenseignore
+++ b/.licenseignore
@@ -13,3 +13,4 @@ public/*
 .yarnrc
 .npmrc
 src/lib/cwl-svg/*
+tools/arvados_config.yml

commit 96626db04a7dcb11b21d92203a6ddd81577191bf
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Oct 15 15:25:17 2020 -0300

    16719: Adds integration test for collection's old version searching.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/cypress/integration/search.spec.js b/cypress/integration/search.spec.js
new file mode 100644
index 00000000..0fba64cd
--- /dev/null
+++ b/cypress/integration/search.spec.js
@@ -0,0 +1,83 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+describe('Search tests', function() {
+    let activeUser;
+    let adminUser;
+
+    before(function() {
+        // Only set up common users once. These aren't set up as aliases because
+        // aliases are cleaned up after every test. Also it doesn't make sense
+        // to set the same users on beforeEach() over and over again, so we
+        // separate a little from Cypress' 'Best Practices' here.
+        cy.getUser('admin', 'Admin', 'User', true, true)
+            .as('adminUser').then(function() {
+                adminUser = this.adminUser;
+            }
+        );
+        cy.getUser('collectionuser1', 'Collection', 'User', false, true)
+            .as('activeUser').then(function() {
+                activeUser = this.activeUser;
+            }
+        );
+    })
+
+    beforeEach(function() {
+        cy.clearCookies()
+        cy.clearLocalStorage()
+    })
+
+    it('can search for old collection versions', function() {
+        const colName = `Versioned Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
+        let colUuid = '';
+        let oldVersionUuid = '';
+        // Make sure no other collections with this name exist
+        cy.doRequest('GET', '/arvados/v1/collections', null, {
+            filters: `[["name", "=", "${colName}"]]`,
+            include_old_versions: true
+        })
+        .its('body.items').as('collections')
+        .then(function() {
+            expect(this.collections).to.be.empty;
+        });
+        // Creates the collection using the admin token so we can set up
+        // a bogus manifest text without block signatures.
+        cy.createCollection(adminUser.token, {
+            name: colName,
+            owner_uuid: activeUser.user.uuid,
+            manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
+        .as('originalVersion').then(function() {
+            // Change the file name to create a new version.
+            cy.updateCollection(adminUser.token, this.originalVersion.uuid, {
+                manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n"
+            })
+            colUuid = this.originalVersion.uuid;
+        });
+        // Confirm that there are 2 versions of the collection
+        cy.doRequest('GET', '/arvados/v1/collections', null, {
+            filters: `[["name", "=", "${colName}"]]`,
+            include_old_versions: true
+        })
+        .its('body.items').as('collections')
+        .then(function() {
+            expect(this.collections).to.have.lengthOf(2);
+            this.collections.map(function(aCollection) {
+                expect(aCollection.current_version_uuid).to.equal(colUuid);
+                if (aCollection.uuid !== aCollection.current_version_uuid) {
+                    oldVersionUuid = aCollection.uuid;
+                }
+            });
+            cy.loginAs(activeUser);
+            const searchQuery = `${colName} type:arvados#collection`;
+            // Search for only collection's current version
+            cy.visit(`/search-results?q=${encodeURIComponent(searchQuery)}`);
+            cy.get('[data-cy=search-results]').should('contain', 'current');
+            cy.get('[data-cy=search-results]').should('not.contain', 'old version');
+            // ...and then, include old versions.
+            cy.visit(`/search-results?q=${encodeURIComponent(searchQuery + ' is:pastVersion')}`);
+            cy.get('[data-cy=search-results]').should('contain', 'current');
+            cy.get('[data-cy=search-results]').should('contain', 'old version');
+        });
+    });
+});
\ No newline at end of file
diff --git a/src/views-components/search-bar/search-bar-view.tsx b/src/views-components/search-bar/search-bar-view.tsx
index 49a8ba62..20536fd7 100644
--- a/src/views-components/search-bar/search-bar-view.tsx
+++ b/src/views-components/search-bar/search-bar-view.tsx
@@ -177,6 +177,7 @@ export const SearchBarView = compose(connectVocabulary, withStyles(styles))(
                     <Paper className={isPopoverOpen ? classes.containerSearchViewOpened : classes.container} >
                         <form onSubmit={this.handleSubmit}>
                             <Input
+                                data-cy='search-input-field'
                                 className={classes.input}
                                 onChange={this.handleChange}
                                 placeholder="Search"
diff --git a/src/views/search-results-panel/search-results-panel-view.tsx b/src/views/search-results-panel/search-results-panel-view.tsx
index fbaba210..dae91bd0 100644
--- a/src/views/search-results-panel/search-results-panel-view.tsx
+++ b/src/views/search-results-panel/search-results-panel-view.tsx
@@ -108,7 +108,7 @@ export const SearchResultsPanelView = withStyles(styles, { withTheme: true })(
     (props: SearchResultsPanelProps & WithStyles<CssRules, true>) => {
         const homeCluster = props.user.uuid.substr(0, 5);
         const loggedIn = props.sessions.filter((ss) => ss.loggedIn && ss.userIsActive);
-        return <DataExplorer
+        return <span data-cy='search-results'><DataExplorer
             id={SEARCH_RESULTS_PANEL_ID}
             onRowClick={props.onItemClick}
             onRowDoubleClick={props.onItemDoubleClick}
@@ -127,5 +127,5 @@ export const SearchResultsPanelView = withStyles(styles, { withTheme: true })(
                         : <span style={{ marginLeft: "2em" }}>Use <Link to={Routes.SITE_MANAGER} >Site Manager</Link> to manage which clusters will be searched.</span>}
                 </div >
             }
-        />;
+        /></span>;
     });

commit 8516425bd1c541476dc2d5cb00a762691cd753e1
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Oct 15 13:45:09 2020 -0300

    16719: Adds integration test for old collection version display.
    
    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 c14101d8..414d7e3e 100644
--- a/cypress/integration/collection-panel.spec.js
+++ b/cypress/integration/collection-panel.spec.js
@@ -54,7 +54,8 @@ describe('Collection panel tests', function() {
                     // Check that name & uuid are correct.
                     cy.get('[data-cy=collection-info-panel]')
                         .should('contain', this.testCollection.name)
-                        .and('contain', this.testCollection.uuid);
+                        .and('contain', this.testCollection.uuid)
+                        .and('not.contain', 'This is an old version');
                     // Check for the read-only icon
                     cy.get('[data-cy=read-only-icon]').should(`${isWritable ? 'not.' : ''}exist`);
                     // Check that both read and write operations are available on
@@ -117,4 +118,54 @@ describe('Collection panel tests', function() {
             })
         })
     })
+
+    it('can correctly display old versions', function() {
+        const colName = `Versioned Collection ${Math.floor(Math.random() * Math.floor(999999))}`;
+        let colUuid = '';
+        let oldVersionUuid = '';
+        // Make sure no other collections with this name exist
+        cy.doRequest('GET', '/arvados/v1/collections', null, {
+            filters: `[["name", "=", "${colName}"]]`,
+            include_old_versions: true
+        })
+        .its('body.items').as('collections')
+        .then(function() {
+            expect(this.collections).to.be.empty;
+        });
+        // Creates the collection using the admin token so we can set up
+        // a bogus manifest text without block signatures.
+        cy.createCollection(adminUser.token, {
+            name: colName,
+            owner_uuid: activeUser.user.uuid,
+            manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
+        .as('originalVersion').then(function() {
+            // Change the file name to create a new version.
+            cy.updateCollection(adminUser.token, this.originalVersion.uuid, {
+                manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n"
+            })
+            colUuid = this.originalVersion.uuid;
+        });
+        // Confirm that there are 2 versions of the collection
+        cy.doRequest('GET', '/arvados/v1/collections', null, {
+            filters: `[["name", "=", "${colName}"]]`,
+            include_old_versions: true
+        })
+        .its('body.items').as('collections')
+        .then(function() {
+            expect(this.collections).to.have.lengthOf(2);
+            this.collections.map(function(aCollection) {
+                expect(aCollection.current_version_uuid).to.equal(colUuid);
+                if (aCollection.uuid !== aCollection.current_version_uuid) {
+                    oldVersionUuid = aCollection.uuid;
+                }
+            });
+            // Check the old version displays as what it is.
+            cy.loginAs(activeUser)
+            cy.visit(`/collections/${oldVersionUuid}`);
+            cy.get('[data-cy=collection-info-panel]').should('contain', 'This is an old version');
+            cy.get('[data-cy=read-only-icon]').should('exist');
+            cy.get('[data-cy=collection-info-panel]').should('contain', colName);
+            cy.get('[data-cy=collection-files-panel]').should('contain', 'bar');
+        });
+    });
 })
diff --git a/cypress/support/commands.js b/cypress/support/commands.js
index fd513998..228e1cab 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.js
@@ -125,6 +125,14 @@ Cypress.Commands.add(
     }
 )
 
+Cypress.Commands.add(
+    "updateCollection", (token, uuid, data) => {
+        return cy.updateResource(token, 'collections', uuid, {
+            collection: JSON.stringify(data)
+        })
+    }
+)
+
 Cypress.Commands.add(
     "createResource", (token, suffix, data) => {
         return cy.doRequest('POST', '/arvados/v1/'+suffix, data, null, token, true)
@@ -145,6 +153,16 @@ Cypress.Commands.add(
     }
 )
 
+Cypress.Commands.add(
+    "updateResource", (token, suffix, uuid, data) => {
+        return cy.doRequest('PUT', '/arvados/v1/'+suffix+'/'+uuid, data, null, token, true)
+        .its('body').as('resource')
+        .then(function() {
+            return this.resource;
+        })
+    }
+)
+
 Cypress.Commands.add(
     "loginAs", (user) => {
         cy.visit(`/token/?api_token=${user.token}`);
diff --git a/tools/arvados_config.yml b/tools/arvados_config.yml
index 8882eac2..b533156d 100644
--- a/tools/arvados_config.yml
+++ b/tools/arvados_config.yml
@@ -7,6 +7,8 @@ Clusters:
     TLS:
       Insecure: true
     Collections:
+      CollectionVersioning: true
+      PreserveVersionIfIdle: 0s
       BlobSigningKey: zfhgfenhffzltr9dixws36j1yhksjoll2grmku38mi7yxd66h5j4q9w4jzanezacp8s6q0ro3hxakfye02152hncy6zml2ed0uc
       TrustAllContent: true
       ForwardSlashNameSubstitution: /

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list