Skip to content

Commit

Permalink
Merge branch 'main' into task/WP-80-execution-system
Browse files Browse the repository at this point in the history
  • Loading branch information
chandra-tacc authored Feb 13, 2024
2 parents 9c3d577 + 03ce6fa commit e91c26b
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 93 deletions.
4 changes: 2 additions & 2 deletions client/src/redux/sagas/datafiles.sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ export const defaultAllocationSelector = (state) =>
state.allocations.portal_alloc || state.allocations.active[0].projectName;

const getExtractParams = (file, latestExtract, defaultAllocation) => {
const inputFile = encodeURI(`tapis://${file.system}/${file.path}`);
const inputFile = `tapis://${file.system}/${file.path}`;
const archivePath = `${file.path.slice(0, -file.name.length)}`;
return JSON.stringify({
job: {
Expand Down Expand Up @@ -1000,7 +1000,7 @@ const getCompressParams = (
defaultAllocation
) => {
const fileInputs = files.map((file) => ({
sourceUrl: encodeURI(`tapis://${file.system}/${file.path}`),
sourceUrl: `tapis://${file.system}/${file.path}`,
}));

let archivePath, archiveSystem;
Expand Down
194 changes: 103 additions & 91 deletions client/src/redux/sagas/datafiles.sagas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,99 +311,111 @@ describe('scrollFiles', () => {
});
});

describe('extractFiles', () => {
const jobHelperExpected = () =>
JSON.stringify({
job: {
fileInputs: [
{
name: 'Input File',
sourceUrl: 'tapis://test.system/dir/test.zip',
},
],
name: `extract-0.0.1_${new Date().toISOString().split('.')[0]}`,
archiveSystemId: 'test.system',
archiveSystemDir: 'dir/',
archiveOnAppError: false,
appId: 'extract',
appVersion: '0.0.1',
parameterSet: {
appArgs: [],
schedulerOptions: [
{
name: 'TACC Allocation',
description:
'The TACC allocation associated with this job execution',
include: true,
arg: '-A TACC-ACI',
},
],
},
execSystemId: 'frontera',
},
});

const action = {
type: 'DATA_FILES_EXTRACT',
payload: {
file: {
system: 'test.system',
path: 'dir/test.zip',
name: 'test.zip',
},
describe('Test extract with different file names', () => {
// Paths without and with space to ensure there is no encoding.
const sourceUrlPaths = [
{ tapis_path: 'tapis://test.system/dir/test.zip', name: 'test.zip' },
{
tapis_path: 'tapis://test.system/dir/test file.zip',
name: 'test file.zip',
},
};

it('runs extractFiles saga with success', () => {
return expectSaga(extractFiles, action)
.provide([
[select(extractAppSelector), 'extract'],
[select(defaultAllocationSelector), 'TACC-ACI'],
[matchers.call.fn(fetchAppDefinitionUtil), extractApp],
[matchers.call.fn(jobHelper), { status: 'PENDING' }],
])
.call(fetchAppDefinitionUtil, 'extract')
.put({
type: 'DATA_FILES_SET_OPERATION_STATUS',
payload: { status: 'RUNNING', operation: 'extract' },
})
.call(jobHelper, jobHelperExpected())
.put({
type: 'DATA_FILES_SET_OPERATION_STATUS',
payload: { status: 'SUCCESS', operation: 'extract' },
})
.run();
});
];
sourceUrlPaths.forEach((pathInfo) => {
describe('extractFiles', () => {
const jobHelperExpected = () =>
JSON.stringify({
job: {
fileInputs: [
{
name: 'Input File',
sourceUrl: pathInfo['tapis_path'],
},
],
name: `extract-0.0.1_${new Date().toISOString().split('.')[0]}`,
archiveSystemId: 'test.system',
archiveSystemDir: 'dir/',
archiveOnAppError: false,
appId: 'extract',
appVersion: '0.0.1',
parameterSet: {
appArgs: [],
schedulerOptions: [
{
name: 'TACC Allocation',
description:
'The TACC allocation associated with this job execution',
include: true,
arg: '-A TACC-ACI',
},
],
},
execSystemId: 'frontera',
},
});

it('runs extractFiles saga with push keys modal', () => {
return expectSaga(extractFiles, action)
.provide([
[select(extractAppSelector), 'extract'],
[select(defaultAllocationSelector), 'TACC-ACI'],
[matchers.call.fn(fetchAppDefinitionUtil), extractApp],
[matchers.call.fn(jobHelper), { execSys: 'test.cli.system' }],
])
.call(fetchAppDefinitionUtil, 'extract')
.put({
type: 'DATA_FILES_SET_OPERATION_STATUS',
payload: { status: 'RUNNING', operation: 'extract' },
})
.call(jobHelper, jobHelperExpected())
.put({
type: 'SYSTEMS_TOGGLE_MODAL',
const action = {
type: 'DATA_FILES_EXTRACT',
payload: {
operation: 'pushKeys',
props: {
onSuccess: action,
system: 'test.cli.system',
onCancel: {
type: 'DATA_FILES_SET_OPERATION_STATUS',
payload: { status: 'ERROR', operation: 'extract' },
},
file: {
system: 'test.system',
path: `dir/${pathInfo['name']}`,
name: pathInfo['name'],
},
},
})
.run();
};

it('runs extractFiles saga with success', () => {
return expectSaga(extractFiles, action)
.provide([
[select(extractAppSelector), 'extract'],
[select(defaultAllocationSelector), 'TACC-ACI'],
[matchers.call.fn(fetchAppDefinitionUtil), extractApp],
[matchers.call.fn(jobHelper), { status: 'PENDING' }],
])
.call(fetchAppDefinitionUtil, 'extract')
.put({
type: 'DATA_FILES_SET_OPERATION_STATUS',
payload: { status: 'RUNNING', operation: 'extract' },
})
.call(jobHelper, jobHelperExpected())
.put({
type: 'DATA_FILES_SET_OPERATION_STATUS',
payload: { status: 'SUCCESS', operation: 'extract' },
})
.run();
});

it('runs extractFiles saga with push keys modal', () => {
return expectSaga(extractFiles, action)
.provide([
[select(extractAppSelector), 'extract'],
[select(defaultAllocationSelector), 'TACC-ACI'],
[matchers.call.fn(fetchAppDefinitionUtil), extractApp],
[matchers.call.fn(jobHelper), { execSys: 'test.cli.system' }],
])
.call(fetchAppDefinitionUtil, 'extract')
.put({
type: 'DATA_FILES_SET_OPERATION_STATUS',
payload: { status: 'RUNNING', operation: 'extract' },
})
.call(jobHelper, jobHelperExpected())
.put({
type: 'SYSTEMS_TOGGLE_MODAL',
payload: {
operation: 'pushKeys',
props: {
onSuccess: action,
system: 'test.cli.system',
onCancel: {
type: 'DATA_FILES_SET_OPERATION_STATUS',
payload: { status: 'ERROR', operation: 'extract' },
},
},
},
})
.run();
});
});
});
});

Expand All @@ -421,8 +433,8 @@ describe('compressFiles', () => {
},
{
system: 'test.system',
path: 'test2.txt',
name: 'test2.txt',
path: 'test 2.txt',
name: 'test 2.txt',
},
],
compressionType: 'zip',
Expand All @@ -439,7 +451,7 @@ describe('compressFiles', () => {
sourceUrl: 'tapis://test.system/test1.txt',
},
{
sourceUrl: 'tapis://test.system/test2.txt',
sourceUrl: 'tapis://test.system/test 2.txt',
},
],
name: `compress-0.0.1_${new Date().toISOString().split('.')[0]}`,
Expand Down

0 comments on commit e91c26b

Please sign in to comment.