Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redux and Component tests, coverage. Normalize redux actions. #420

Merged
merged 21 commits into from
Jun 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ script:
# Run client tests, only with python 2.7
- if [ -n "${PY2}" ]; then npm install; fi
- if [ -n "${PY2}" ]; then npm run build:release; fi
- if [ -n "${PY2}" ]; then npm run test; fi
- if [ -n "${PY2}" ]; then npm run codecov; fi
# Now run server tests
- mkdir _girder_build
- pushd _girder_build
Expand Down
29 changes: 7 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## HPCCloud ##
# HPC Cloud #

[![codecov.io](https://codecov.io/github/Kitware/HPCCloud/coverage.svg?branch=master)](https://codecov.io/github/Kitware/HPCCloud?branch=master)
[![Build Status](https://travis-ci.org/Kitware/HPCCloud.svg?branch=master)](https://travis-ci.org/Kitware/HPCCloud)

### Goal ###

Expand All @@ -7,26 +10,7 @@ environment and resources on which you can run those simulations.

## Installation

```
$ npm install
```

After installing the package you will get one executable **HPCCloud** with
the following set of options.

```
$ HPCCloud

Usage: HPCCloud [options]

Options:

-h, --help output usage information
-V, --version output the version number

>>> FIXME <<<

```
Observe the instructions for [HPCCloud deploy](https://github.com/Kitware/HPCCloud-deploy);

## Development

Expand All @@ -37,8 +21,9 @@ $ npm install
$ npm start
```

## Trouble shooting
## Troubleshooting

(With the vm running from HPCCloud-Deploy)
```sh
$ vagrant ssh
$ sudo -iu hpccloud
Expand Down
30 changes: 24 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@
"bootstrap": "3.3.6",
"react-router": "2.0.1",

"karma": "0.13.22",
"karma-jasmine": "1.0.2",
"karma-spec-reporter": "0.0.26",
"karma-webpack": "1.7.0",
"karma-phantomjs-launcher": "1.0.0",
"karma-coverage": "1.0.0",
"karma-sourcemap-loader": "0.3.7",
"istanbul-instrumenter-loader": "0.2.0",
"phantomjs-prebuilt": "2.1.7",
"jasmine": "2.4.1",
"redux-actions-assertions": "1.1.0",
"redux-thunk": "2.1.0",
"expect": "1.20.1",
"codecov.io": "0.1.6",

"babel-polyfill": "6.9.1",
"paraviewweb": "1.6.0",
"simput": "1.2.0",
"pvw-visualizer": "1.0.11",
Expand All @@ -47,15 +63,17 @@
"postinstall" : "npm run install:pyfr && fix-kw-web-suite || true",
"check" : "node bin/version-check.js",

"env:dev" : "export NODE_ENV='development'",
"env:prod" : "export NODE_ENV='production'",

"prebuild" : "npm run check && npm run env:dev",
"prebuild" : "npm run check",
"build" : "fix-autobahn && webpack --progress --colors",
"build:debug" : "fix-autobahn && webpack --display-modules",
"build:release" : "npm run env:prod && fix-autobahn && webpack -p --progress --colors",
"build:release" : "fix-autobahn && NODE_ENV='production' webpack -p --progress --colors",

"start": "fix-autobahn && webpack-dev-server --progress --open",

"start": "npm run env:dev && fix-autobahn && webpack-dev-server --progress --open",
"test": "NODE_ENV='test' karma start test/karma.all.js",
"test:redux": "NODE_ENV='test' karma start test/karma.redux.js",
"test:component": "NODE_ENV='test' karma start test/karma.component.js",
"codecov": "cat coverage/lcov/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js",

"commit" : "git cz",
"semantic-release" : "semantic-release pre && npm publish && semantic-release post"
Expand Down
14 changes: 12 additions & 2 deletions src/network/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ const endpoints = [
user,
];

const girderClient = ClientBuilder.build(
window.location, endpoints);
var url;
if (process.env.NODE_ENV === 'test') {
url = {
protocol: 'http:',
hostname: 'test',
port: 80,
};
} else {
url = window.location;
}

const girderClient = ClientBuilder.build(url, endpoints);

export default girderClient;
4 changes: 4 additions & 0 deletions src/network/remote/GirderClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ export function build(config = location, ...extensions) {
processExtension(extensions);

// Return the newly composed object
// if env === test, return an unfrozen version so we can spy on it
if (process.env.NODE_ENV === 'test') {
return publicObject;
}
return Object.freeze(publicObject);
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/Preferences/Cluster/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const ClusterPrefs = React.createClass({

clusterHasSimulation(id) {
for (let i = 0; i < this.props.taskflows.length; i++) {
if (this.props.taskflows[i].flow && this.props.taskflows[i].flow.meta.cluster._id === id) {
if (this.props.taskflows[i].flow && get(this.props.taskflows[i].flow, 'meta.cluster._id') === id) {
return this.props.taskflows[i].simulation;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/panels/FileListing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const FileListing = React.createClass({
}

this.setState({ opened });
this.props.toggleOpenFolder(id, !this.props.folders[id].open, opened);
this.props.toggleOpenFolder(id, !this.props.folders[id].open);
},

render() {
Expand Down Expand Up @@ -209,6 +209,6 @@ export default connect(
};
},
() => ({
toggleOpenFolder: (folderId, opening, opened) => dispatch(Actions.toggleOpenFolder(folderId, opening, opened)),
toggleOpenFolder: (folderId, opening) => dispatch(Actions.toggleOpenFolder(folderId, opening)),
})
)(FileListing);
97 changes: 50 additions & 47 deletions src/redux/actions/aws.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,65 +28,68 @@ export function updateAWSProfiles(profiles) {
}

export function fetchAWSProfiles() {
const action = netActions.addNetworkCall('fetch_aws_profiles', 'Retreive AWS profiles');
dispatch(pendingNetworkCall(true));
client.listAWSProfiles()
.then((resp) => {
dispatch(netActions.successNetworkCall(action.id, resp));
dispatch(updateAWSProfiles(resp.data));
dispatch(pendingNetworkCall(false));
})
.catch((error) => {
dispatch(netActions.errorNetworkCall(action.id, error));
dispatch(pendingNetworkCall(false));
});
return dispatch => {
const action = netActions.addNetworkCall('fetch_aws_profiles', 'Retreive AWS profiles');
dispatch(pendingNetworkCall(true));
client.listAWSProfiles()
.then((resp) => {
dispatch(netActions.successNetworkCall(action.id, resp));
dispatch(updateAWSProfiles(resp.data));
dispatch(pendingNetworkCall(false));
})
.catch((error) => {
dispatch(netActions.errorNetworkCall(action.id, error));
dispatch(pendingNetworkCall(false));
});

return action;
return action;
};
}

export function removeAWSProfile(index, profile) {
return dispatch => {
if (profile._id) {
const action = netActions.addNetworkCall('remove_aws_profile', 'Remove cluster');
if (!profile._id) {
return { type: REMOVE_AWS_PROFILE, index };
}

dispatch(pendingNetworkCall(true));
client.deleteAWSProfile(profile._id)
.then(
resp => {
dispatch(netActions.successNetworkCall(action.id, resp));
dispatch(pendingNetworkCall(false));
dispatch(fetchAWSProfiles());
},
err => {
dispatch(netActions.errorNetworkCall(action.id, err));
dispatch(pendingNetworkCall(false));
});
return dispatch => {
const action = netActions.addNetworkCall('remove_aws_profile', 'Remove cluster');

return action;
}
dispatch(pendingNetworkCall(true));
client.deleteAWSProfile(profile._id)
.then(
resp => {
dispatch(netActions.successNetworkCall(action.id, resp));
dispatch(pendingNetworkCall(false));
dispatch(fetchAWSProfiles());
},
err => {
dispatch(netActions.errorNetworkCall(action.id, err));
dispatch(pendingNetworkCall(false));
});

return { type: REMOVE_AWS_PROFILE, index };
return action;
};
}

export function updateAWSProfile(index, profile, pushToServer = false) {
return dispatch => {
if (pushToServer) {
const action = netActions.addNetworkCall('save_aws_profile', 'Save cluster');
dispatch(pendingNetworkCall(true));
client.createAWSProfile(profile)
.then(
resp => {
dispatch(pendingNetworkCall(false));
dispatch(netActions.successNetworkCall(action.id, resp));
dispatch(fetchAWSProfiles());
},
err => {
dispatch(netActions.errorNetworkCall(action.id, err));
dispatch(pendingNetworkCall(false));
});
}
if (!pushToServer) {
return { type: SAVE_AWS_PROFILE, index, profile };
}
return dispatch => {
const action = netActions.addNetworkCall('save_aws_profile', 'Save cluster');
dispatch(pendingNetworkCall(true));
client.createAWSProfile(profile)
.then(
resp => {
dispatch(pendingNetworkCall(false));
dispatch(netActions.successNetworkCall(action.id, resp));
dispatch(fetchAWSProfiles());
},
err => {
dispatch(netActions.errorNetworkCall(action.id, err));
dispatch(pendingNetworkCall(false));
});
return action;
};
}

Expand Down
Loading