Skip to content

Commit

Permalink
improve scripts for performance testing #2036
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Jul 15, 2015
1 parent b63601f commit 1f60f68
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions scripts/database/homebrew/convert
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
sed -i -e "s/postgres/$USER/" /tmp/dataverse_db.sql
sed -i -e 's/dvnapp/dataverse_app/' /tmp/dataverse_db.sql
sed -i -e 's/dvn-vm7.hmdc.harvard.edu:8983/localhost:8983/' /tmp/dataverse_db.sql
8 changes: 4 additions & 4 deletions scripts/issues/50/grant-role-then-revoke
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/sh
SERVER=staging.dataverse.org
SERVER=http://localhost:8080
DATAVERSE=togo
USERID="@pdurbin"
ROLE=admin

echo "Assigning $ROLE to $USERID on $DATAVERSE..."
OUT_ASSIGN=`time curl -s -X POST -H "Content-type:application/json" -d "{\"assignee\": \"$USERID\",\"role\": \"$ROLE\"}" "https://$SERVER/api/dataverses/$DATAVERSE/assignments?key=$API_TOKEN"`
OUT_ASSIGN=`time curl -s -X POST -H "Content-type:application/json" -d "{\"assignee\": \"$USERID\",\"role\": \"$ROLE\"}" "$SERVER/api/dataverses/$DATAVERSE/assignments?key=$API_TOKEN"`
echo $OUT_ASSIGN | jq '.data | {assignee,_roleAlias}'

echo "Retrieving ID of role to revoke..."
ASSIGNMENTS=`time curl -s "https://$SERVER/api/dataverses/$DATAVERSE/assignments?key=$API_TOKEN"`
ASSIGNMENTS=`time curl -s "$SERVER/api/dataverses/$DATAVERSE/assignments?key=$API_TOKEN"`
echo $ASSIGNMENTS | jq ".data[] | select(.assignee==\"$USERID\") | ."

echo "Revoking $ROLE from $USERID on $DATAVERSE..."
ID_TO_REVOKE=`echo $ASSIGNMENTS | jq ".data[] | select(.assignee==\"$USERID\") | .id"`
OUT_REVOKE=`time curl -s -X DELETE "https://$SERVER/api/dataverses/$DATAVERSE/assignments/$ID_TO_REVOKE?key=$API_TOKEN"`
OUT_REVOKE=`time curl -s -X DELETE "$SERVER/api/dataverses/$DATAVERSE/assignments/$ID_TO_REVOKE?key=$API_TOKEN"`
echo $OUT_REVOKE | jq '.data.message'

0 comments on commit 1f60f68

Please sign in to comment.