Skip to content

Commit 8a8f89b

Browse files
committed
updates
1 parent 7d6f64e commit 8a8f89b

File tree

2 files changed

+42
-39
lines changed

2 files changed

+42
-39
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## Unreleased
88
### Added
9+
- add script to test Clowder extraction.
910
- add script to submit files to Clowder geo extraction.
1011
- Added ability to delete extractor, both from api and GUI.
1112
[CATS-1044](https://opensource.ncsa.illinois.edu/jira/browse/CATS-1044)

scripts/tester/tester.sh

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -28,69 +28,71 @@ post_message() {
2828

2929
# ------------------------ Create dataset ------------------------
3030
DATASET_ID=$(curl -X POST -H "Content-Type: application/json" \
31-
-d '{"name":"Temporary Test Dataset", "description":"Created automatically by test script."}' \
32-
$CLOWDER_URL/api/datasets/createempty?key=$CLOWDER_KEY)
31+
-d '{"name":"Temporary Test Dataset", "description":"Created automatically by test script."}' \
32+
$CLOWDER_URL/api/datasets/createempty?key=$CLOWDER_KEY)
3333
DATASET_ID=$(echo $DATASET_ID | jq '.id' | sed s/\"//g)
3434
echo "Dataset ID: $DATASET_ID"
3535

3636
# ------------------------ Upload file ------------------------
3737
FILE_ID=$(curl -X POST -H "Content-Type: application/json" \
38-
-F File=@$TARGET_FILE \
39-
$CLOWDER_URL/api/uploadToDataset/$DATASET_ID?key=$CLOWDER_KEY&extract=0)
38+
-F File=@$TARGET_FILE \
39+
$CLOWDER_URL/api/uploadToDataset/$DATASET_ID?key=$CLOWDER_KEY&extract=0)
4040
FILE_ID=$(echo $FILE_ID | jq '.id' | sed s/\"//g)
4141
echo "File ID: $FILE_ID"
4242

4343
# Validate upload
4444
FILE_UPLOADED=0
4545
RETRIES=0
4646
while [ $FILE_UPLOADED = 0 ]; do
47-
RESPONSE=$(curl -X GET -H "Content-Type: application/json" \
48-
$CLOWDER_URL/api/files/$FILE_ID/metadata?key=$CLOWDER_KEY)
49-
RESPONSE=$(echo $RESPONSE | jq '.status' | sed s/\"//g)
50-
if [ "$RESPONSE" = "PROCESSED" ]; then
51-
FILE_UPLOADED=1
52-
fi
53-
RETRIES=$((RETRIES+1))
54-
if [ $RETRIES = 12 ]; then
55-
echo "File upload not PROCESSED after 2 minutes. There may be a problem. Deleting dataset."
56-
curl -X DELETE $CLOWDER_URL/api/datasets/$DATASET_ID?key=$CLOWDER_KEY
57-
post_message("Upload+extract test script failing on $CLOWDER_URL/files/$FILE_ID (status is not PROCESSED)")
58-
exit 1
59-
fi
60-
echo "File upload not complete; checking again in 10 seconds."
61-
sleep 10
47+
RESPONSE=$(curl -X GET -H "Content-Type: application/json" \
48+
$CLOWDER_URL/api/files/$FILE_ID/metadata?key=$CLOWDER_KEY)
49+
RESPONSE=$(echo $RESPONSE | jq '.status' | sed s/\"//g)
50+
if [ "$RESPONSE" = "PROCESSED" ]; then
51+
FILE_UPLOADED=1
52+
fi
53+
RETRIES=$((RETRIES+1))
54+
if [ $RETRIES = 12 ]; then
55+
echo "File upload not PROCESSED after 2 minutes. There may be a problem. Deleting dataset."
56+
curl -X DELETE $CLOWDER_URL/api/datasets/$DATASET_ID?key=$CLOWDER_KEY
57+
post_message "Upload+extract test script failing on $CLOWDER_URL\/files\/$FILE_ID (status is not PROCESSED)"
58+
exit 1
59+
fi
60+
echo "File upload not complete; checking again in 10 seconds."
61+
sleep 10
6262
done
6363
echo "File upload complete."
6464

6565
# ------------------------ Submit for extraction ------------------------
6666
curl -X POST -H "Content-Type: application/json" \
67-
-d '{"extractor": "ncsa.file.digest"}' \
68-
$CLOWDER_URL/api/files/$FILE_ID/extractions?key=$CLOWDER_KEY
67+
-d '{"extractor": "ncsa.file.digest"}' \
68+
$CLOWDER_URL/api/files/$FILE_ID/extractions?key=$CLOWDER_KEY
6969

7070
# Validate extraction
7171
FILE_EXTRACTED=0
7272
RETRIES=0
73-
while [ FILE_EXTRACTED = 0 ]; do
74-
RESPONSE=$(curl -X GET -H "Content-Type: application/json" \
75-
$CLOWDER_URL/api/extractions/$FILE_ID/status?key=$CLOWDER_KEY)
76-
RESPONSE=$(echo $RESPONSE | jq '.ncsa.file.digest' | sed s/\"//g)
77-
if [ "$RESPONSE" = "DONE" ]; then
78-
FILE_EXTRACTED=1
79-
fi
80-
RETRIES=$((RETRIES+1))
81-
if [ $RETRIES = 24 ]; then
82-
echo "File extraction not DONE after 4 minutes. There may be a problem. Deleting dataset."
83-
curl -X DELETE $CLOWDER_URL/api/datasets/$DATASET_ID?key=$CLOWDER_KEY
84-
post_message("Upload+extract test script failing on $CLOWDER_URL/files/$FILE_ID (extractor not DONE)")
85-
exit 1
86-
fi
87-
echo "File extraction not complete; checking again in 10 seconds."
88-
sleep 10
73+
while [ $FILE_EXTRACTED -eq 0 ]; do
74+
RESPONSE=$(curl -X GET -H "Content-Type: application/json" \
75+
$CLOWDER_URL/api/extractions/$FILE_ID/status?key=$CLOWDER_KEY)
76+
echo $RESPONSE
77+
RESPONSE=$(echo $RESPONSE | jq '."ncsa.file.digest"' | sed s/\"//g)
78+
if [ "$RESPONSE" = "DONE" ]; then
79+
FILE_EXTRACTED=1
80+
post_message "Extractor: [ncsa.file.digest] success $CLOWDER_URL/files/$FILE_ID"
81+
fi
82+
RETRIES=$((RETRIES+1))
83+
if [ $RETRIES = 24 ]; then
84+
echo "File extraction not DONE after 4 minutes. There may be a problem. Deleting dataset."
85+
curl -X DELETE $CLOWDER_URL/api/datasets/$DATASET_ID?key=$CLOWDER_KEY
86+
post_message "Upload+extract test script failing on $CLOWDER_URL/files/$FILE_ID (extractor not DONE)"
87+
exit 1
88+
fi
89+
echo "File extraction not complete; checking again in 10 seconds."
90+
sleep 10
8991
done
9092
echo "File extraction complete."
91-
93+
9294

9395
# ------------------------ Delete dataset ------------------------
9496
curl -X DELETE $CLOWDER_URL/api/datasets/$DATASET_ID?key=$CLOWDER_KEY
9597

96-
echo "Test complete."
98+
echo "Test complete."

0 commit comments

Comments
 (0)