mgr/dashboard: Improve e2e script

Passing -r flag to jq to remove quotes. sed not needed
Using $() command substitution instead of the legacy and unsafe backticks `...`

Signed-off-by: Valentin Bajrami <valentin.bajrami@gmail.com>
This commit is contained in:
Valentin B 2019-07-12 12:15:09 +02:00 committed by Valentin Bajrami
parent 7910bd6f02
commit bfd703820f
No known key found for this signature in database
GPG Key ID: 396F17CCD0C8A487

View File

@ -50,13 +50,13 @@ if [ "$BASE_URL" == "" ]; then
./bin/radosgw-admin user create --uid=dev --display-name=Developer --system
# Set the user-id
./bin/ceph dashboard set-rgw-api-user-id dev
# Obtain and set access and secret key for the previously created user
./bin/ceph dashboard set-rgw-api-access-key `./bin/radosgw-admin user info --uid=dev | jq .keys[0].access_key | sed -e 's/^"//' -e 's/"$//'`
./bin/ceph dashboard set-rgw-api-secret-key `./bin/radosgw-admin user info --uid=dev | jq .keys[0].secret_key | sed -e 's/^"//' -e 's/"$//'`
# Obtain and set access and secret key for the previously created user. $() is safer than backticks `..`
./bin/ceph dashboard set-rgw-api-access-key $(./bin/radosgw-admin user info --uid=dev | jq -r .keys[0].access_key)
./bin/ceph dashboard set-rgw-api-secret-key $(./bin/radosgw-admin user info --uid=dev | jq -r .keys[0].secret_key)
# Set SSL verify to False
./bin/ceph dashboard set-rgw-api-ssl-verify False
BASE_URL=`./bin/ceph mgr services | jq .dashboard`
BASE_URL=$(./bin/ceph mgr services | jq .dashboard)
fi
cd $DASH_DIR/frontend
@ -65,10 +65,10 @@ jq .[].target=$BASE_URL proxy.conf.json.sample > proxy.conf.json
. $BUILD_DIR/src/pybind/mgr/dashboard/node-env/bin/activate
npm ci
if [ $DEVICE == "chrome" ]; then
if [ "$DEVICE" == "chrome" ]; then
npm run e2e || stop 1
stop 0
elif [ $DEVICE == "docker" ]; then
elif [ "$DEVICE" == "docker" ]; then
failed=0
docker run -d -v $(pwd):/workdir --net=host --name angular-e2e-container rogargon/angular-e2e || failed=1
docker exec angular-e2e-container npm run e2e || failed=1