Fix salt-install's crunch-dispatch-local config and tests
[arvados.git] / tools / salt-install / tests / run-test.sh
1 #!/usr/bin/env /bin/bash
2 # Copyright (C) The Arvados Authors. All rights reserved.
3 #
4 # SPDX-License-Identifier: Apache-2.0
5
6 export ARVADOS_API_TOKEN=changemesystemroottoken
7 export ARVADOS_API_HOST=__CLUSTER__.__DOMAIN__:__HOST_SSL_PORT__
8 export ARVADOS_API_HOST_INSECURE=true
9
10
11 # https://doc.arvados.org/v2.0/install/install-jobs-image.html
12 echo "Creating Arvados Standard Docker Images project"
13 uuid_prefix=$(arv --format=uuid user current | cut -d- -f1)
14 project_uuid=$(arv --format=uuid group create --group "{\"owner_uuid\": \"${uuid_prefix}-tpzed-000000000000000\", \"group_class\":\"project\", \"name\":\"Arvados Standard Docker Images\"}")
15 echo "Arvados project uuid is '${project_uuid}'"
16 read -rd $'\000' newlink <<EOF; arv link create --link "${newlink}"
17 {
18 "tail_uuid":"${uuid_prefix}-j7d0g-fffffffffffffff",
19 "head_uuid":"${project_uuid}",
20 "link_class":"permission",
21 "name":"can_read"
22 }
23 EOF
24
25 echo "Uploading arvados/jobs' docker image to the project"
26 VERSION="2.1.1"
27 arv-keepdocker --pull arvados/jobs ${VERSION} --project-uuid ${project_uuid}
28
29 # Create the initial user
30 echo "Creating initial user ('__INITIAL_USER__')"
31 user=$(arv --format=uuid user create --user '{"email": "__INITIAL_USER_EMAIL__", "username": "__INITIAL_USER__"}')
32 echo "Setting up user ('__INITIAL_USER__')"
33 arv user setup --uuid ${user}
34 echo "Activating user '__INITIAL_USER__'"
35 arv user update --uuid ${user} --user '{"is_active": true}'
36
37 user_api_token=$(arv api_client_authorization create --api-client-authorization "{\"owner_uuid\": \"${user}\"}" | jq -r .api_token)
38
39 echo "Running test CWL workflow"
40 # Change to the user's token and run the workflow
41 export ARVADOS_API_TOKEN=${user_api_token}
42 cwl-runner hasher-workflow.cwl hasher-workflow-job.yml