Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066311
D8878.id32030.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D8878.id32030.diff
View Options
diff --git a/cypress/e2e/vault.cy.js b/cypress/e2e/vault.cy.js
--- a/cypress/e2e/vault.cy.js
+++ b/cypress/e2e/vault.cy.js
@@ -118,6 +118,44 @@
});
+ it('should report pending cooking task when already submitted', function() {
+ // Browse a directory
+ cy.visit(this.directoryUrl);
+
+ // Stub responses when requesting the vault API to simulate
+ // an internal server error
+ cy.intercept(this.vaultDirectoryUrl, {
+ body: this.genVaultDirCookingResponse('pending', 'Processing...')
+ }).as('checkVaultCookingTask');
+
+ cy.intercept('POST', this.vaultDirectoryUrl, {
+ body: this.genVaultDirCookingResponse('pending', 'Processing...')
+ }).as('createVaultCookingTask');
+
+ cy.contains('button', 'Download')
+ .click();
+
+ // Create a vault cooking task through the GUI
+ cy.get('.modal-dialog')
+ .contains('button:visible', 'Ok')
+ .click();
+
+ cy.wait('@createVaultCookingTask');
+
+ // Check success alert is displayed
+ cy.get('.alert-success')
+ .should('be.visible')
+ .should('contain', 'Archive cooking request successfully submitted.');
+
+ // Go to Downloads page
+ cy.visit(this.Urls.vault());
+
+ cy.wait('@checkVaultCookingTask').then(() => {
+ testStatus(this.directory, progressbarColors['pending'], 'Processing...', 'pending');
+ });
+
+ });
+
it('should report an error when vault service is experiencing issues', function() {
// Browse a directory
cy.visit(this.directoryUrl);
@@ -135,7 +173,7 @@
// Check error alert is displayed
cy.get('.alert-danger')
.should('be.visible')
- .should('contain', 'Archive cooking service is currently experiencing issues.');
+ .should('contain', 'Something unexpected happened when requesting the archive cooking service.');
});
it('should report an error when a cooking task creation failed', function() {
diff --git a/swh/web/vault/assets/vault-create-tasks.js b/swh/web/vault/assets/vault-create-tasks.js
--- a/swh/web/vault/assets/vault-create-tasks.js
+++ b/swh/web/vault/assets/vault-create-tasks.js
@@ -35,7 +35,8 @@
const data = await response.json();
// object needs to be cooked
- if (data.exception === 'NotFoundExc' || data.status === 'failed') {
+ const statusForCooking = ['failed', 'pending', 'new'];
+ if (data.exception === 'NotFoundExc' || statusForCooking.includes(data.status)) {
// if last cooking has failed, remove previous task info from localStorage
// in order to force the recooking of the object
swh.vault.removeCookingTaskInfo([swhid]);
@@ -51,7 +52,7 @@
} else {
const cookingServiceDownAlert =
$(htmlAlert('danger',
- 'Archive cooking service is currently experiencing issues.<br/>' +
+ 'Something unexpected happened when requesting the archive cooking service.<br/>' +
'Please try again later.',
true));
cookingServiceDownAlert.css(alertStyle);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 5:34 AM (10 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219355
Attached To
D8878: vault/assets: Fix cooking task creation when there is a pending one
Event Timeline
Log In to Comment