Skip to content

Commit

Permalink
support mds is not enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Nov 12, 2024
1 parent fe0f9f8 commit 04e3abf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
library_write: { users: ['%me%'] },
write: { users: ['%me%'] },
},
dataSources: [dsId],
...(dsId ? { dataSources: [dsId] } : {}),
},
}).then((value) => {
workspaceId = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
library_write: { users: ['%me%'] },
write: { users: ['%me%'] },
},
dataSources: [datasourceId],
...(datasourceId ? { dataSources: [datasourceId] } : {}),
},
}).then((value) => {
workspaceId = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const workspaceName = `test_workspace_search_${Math.random()
.substring(7)}`;
let workspaceDescription = 'This is a search workspace description.';
let workspaceId;
let datasourceId;
let workspaceFeatures = ['use-case-search'];

const MDSEnabled = Cypress.env('DATASOURCE_MANAGEMENT_ENABLED');
Expand All @@ -26,7 +27,7 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
library_write: { users: ['%me%'] },
write: { users: ['%me%'] },
},
dataSources: [datasourceId],
...(datasourceId ? { dataSources: [datasourceId] } : {}),
},
}).then((value) => {
workspaceId = value;
Expand All @@ -39,7 +40,7 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
if (MDSEnabled) {
cy.deleteAllDataSources();
cy.createDataSourceNoAuth().then((result) => {
const datasourceId = result[0];
datasourceId = result[0];
expect(datasourceId).to.be.a('string').that.is.not.empty;
createWorkspace(datasourceId);
});
Expand Down
8 changes: 6 additions & 2 deletions cypress/utils/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,9 @@ Cypress.Commands.add(
cy.request({
method: 'POST',
headers: { 'osd-xsrf': 'opensearch-dashboards' },
url: `${BASE_PATH}/w/${workspaceId}/api/sample_data/${type}?data_source_id=${datasourceId}`,
url: `${BASE_PATH}/w/${workspaceId}/api/sample_data/${type}?data_source_id=${
datasourceId || ''
}`,
});
}
);
Expand All @@ -612,7 +614,9 @@ Cypress.Commands.add(
cy.request({
method: 'DELETE',
headers: { 'osd-xsrf': 'opensearch-dashboards' },
url: `${BASE_PATH}/w/${workspaceId}/api/sample_data/${type}?data_source_id=${datasourceId}`,
url: `${BASE_PATH}/w/${workspaceId}/api/sample_data/${type}?data_source_id=${
datasourceId || ''
}`,
});
}
);
Expand Down

0 comments on commit 04e3abf

Please sign in to comment.