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

Unit testing #36

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
24 changes: 24 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Unit Tests

permissions:
contents: read

on: [push]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout shell test framework shUnit2
uses: actions/checkout@v4
with:
repository: kward/shunit2
path: ${{github.workspace}}/tests/shunit2
fetch-depth: 1
- name: Run unit tests
shell: bash
run: |
export PATH="tests/shunit2:$PATH"
tests/unit_test.sh

34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
# SpiderScripts
Welcome! These are a few scripts that we use at SURF to work with Spider.
Welcome! These are a few scripts that we use at SURF to work with [Spider](https://doc.spider.surfsara.nl/en/latest/Pages/about.html).

## ADA
ADA stands for "Advanced dCache API". It is a client that talks to the dCache storage system API to get all kinds of information like directory listings and file checksums, and to do things like renaming, moving, deleting, staging (restoring from tape), and subscribing to server-sent-events so that you can automate actions when new files are written or files are staged. ADA does not transfer files; we suggest you use [Rclone](https://rclone.org/) for that.

ADA is pre-installed on Spider. If you want to use ADA elsewhere, you can clone this repository.
### Installation
ADA is pre-installed and ready to use on Spider. If you want to use ADA elsewhere, you can clone this repository:

```
git clone https://github.com/sara-nl/SpiderScripts.git
cd SpiderScripts
```
Install dependencies (if not already installed on your system):
```
brew install jq
brew install rclone
```
There are also optional dependencies to run tests and create macaroons:
```
brew install shunit2
pip install pymacaroons
wget https://raw.githubusercontent.com/sara-nl/GridScripts/master/view-macaroon -P ada
wget https://raw.githubusercontent.com/sara-nl/GridScripts/master/get-macaroon -P ada
```

To test the installation, run:
```
tests/unit_test.sh
```

The unit tests will perform a dry-run, i.e. commands are not actually send to the dCache API, but simply printed and compared to what is expected. To perform an integration test, where commands are actually executed on the dCache storage, you must first create a configuration file `tests/test.conf`. See `tests/test_example.conf` for what information is needed. Then run:
```
tests/integration_test.sh
```

### Documentation

For an overview of the commands and options, run:
```
Expand Down
Loading
Loading