-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-heroku-bind.sh
More file actions
executable file
·62 lines (52 loc) · 1.64 KB
/
test-heroku-bind.sh
File metadata and controls
executable file
·62 lines (52 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
cleanup() {
echo "Cleaning up..."
if [[ -n "$heroku_pid" ]]; then
kill -SIGTERM "$heroku_pid" 2>/dev/null
fi
}
./cloudpipe heroku &
heroku_pid=$!
echo "Heroku process started with PID $consumer_pid"
trap cleanup EXIT
sleep 1
heroku=http://localhost:8002
# create the frontend pipe
curl -X POST -u foo:bar $heroku/cloudpipe-frontend/needs/backing_service/bindings -H "Content-Type: application/json" -d '
{
"id":"to_backend",
"proto": "https",
"adapters": ["auth:oidc"],
"other": {
"uri":"http://localhost:8002/cloudpipe-backend/pipes/to_frontend",
"issuer":"http://localhost:8002"
}
}
'
# create the backend pipe
curl -X POST -u foo:bar $heroku/cloudpipe-backend/offers/backing_service/bindings -H "Content-Type: application/json" -d '
{
"id":"to_frontend",
"proto": "https",
"adapters": ["auth:oidc"],
"other": {
"uri":"http://localhost:8002/cloudpipe-frontend/pipes/to_backend",
"issuer":"http://localhost:8002"
}
}
'
sleep 1
# view the pipes
curl -s -u foo:bar $heroku/cloudpipe-frontend/pipes/to_backend | jq '.this.data, .other.data'
curl -s -u foo:bar $heroku/cloudpipe-backend/pipes/to_frontend | jq '.this.data, .other.data'
euri=`curl -s -u foo:bar $heroku/cloudpipe-backend/pipes/to_frontend | jq -r .this.data.URI`
uri=`curl -s -u foo:bar $heroku/cloudpipe-frontend/pipes/to_backend | jq -r .other.data.URI`
if [ "$euri" != "$uri" ]; then
echo "URIs don't match: '$euri' != '$uri'"
exit 1
fi
euri=https://cloudpipe-backend-ed95072588ce.herokuapp.com
if [ "$euri" != "$uri" ]; then
echo "URIs don't match: '$euri' != '$uri'"
exit 1
fi