@@ -38,14 +38,12 @@ wait_for_uri() {
38
38
echo " $uri ready, continuing"
39
39
}
40
40
41
-
42
- wait_for_uri_with_auth_and_data () {
41
+ wait_for_uri_with_auth () {
43
42
uri=$1
44
- data=$2
45
- expected=$3
43
+ expected=$2
46
44
echo " Waiting for $uri to be available..."
47
45
while true ; do
48
- status=$( curl -s - u Administrator:password -w " %{http_code}" -o /dev/null $uri -d " $data " )
46
+ status=$( curl -u Administrator:password -s - w " %{http_code}" -o /dev/null $uri )
49
47
if [ " x$status " = " x$expected " ]; then
50
48
break
51
49
fi
@@ -90,11 +88,11 @@ curl_check() {
90
88
wait_for_uri http://127.0.0.1:8091/ui/index.html 200
91
89
92
90
echo " Setting memory quotas with curl"
93
- curl -v http://127.0.0.1:8091/pools/default -d memoryQuota=256 -d indexMemoryQuota=256 -d ftsMemoryQuota=256 -d cbasMemoryQuota=1024
91
+ curl_check http://127.0.0.1:8091/pools/default -d memoryQuota=256 -d indexMemoryQuota=256 -d ftsMemoryQuota=256 -d cbasMemoryQuota=1024
94
92
echo
95
93
96
94
echo " Configuring Services with curl"
97
- curl -v http://127.0.0.1:8091/node/controller/setupServices -d services=' kv%2Cn1ql%2Cindex%2Cfts%2Ccbas'
95
+ curl_check http://127.0.0.1:8091/node/controller/setupServices -d services=' kv%2Cn1ql%2Cindex%2Cfts%2Ccbas'
98
96
echo
99
97
100
98
echo " Setting up credentials with curl"
@@ -106,28 +104,25 @@ curl_check -u Administrator:password -X POST http://127.0.0.1:8091/settings/inde
106
104
echo
107
105
108
106
echo " Creating 'datadog-test' bucket with curl"
109
- curl_check -u Administrator:password -X POST http://127.0.0.1:8091/pools/default/buckets -d name=datadog-test -d ramQuotaMB=100 -d authType=sasl \
110
- -d replicaNumber=0 -d bucketType=couchbase
107
+ curl_check -u Administrator:password -X POST http://127.0.0.1:8091/pools/default/buckets -d name=datadog-test -d ramQuotaMB=100 -d authType=sasl -d replicaNumber=0 -d bucketType=couchbase
108
+ sleep 3
109
+ echo
111
110
112
- wait_for_uri_with_auth_and_data http://127.0.0.1:8093/query/service ' statement=SELECT 1' 200
111
+ echo " Creating RBAC 'admin' user on datadog-test bucket"
112
+ couchbase_cli_check user-manage --set \
113
+ --rbac-username admin --rbac-password password \
114
+ --roles ' bucket_full_access[datadog-test]' --auth-domain local \
115
+ -c 127.0.0.1 -u Administrator -p password
116
+ echo
113
117
114
- echo " Adding document to test bucket with curl"
115
- curl -u Administrator:password -X POST http://127.0.0.1:8093/query/service \
116
- -d ' statement=INSERT INTO `datadog-test` ( KEY, VALUE )
117
- VALUES
118
- (
119
- "landmark_1",
120
- {
121
- "id": "1",
122
- "type": "landmark",
123
- "name": "La Tour Eiffel",
124
- "location": "France"
125
- }
126
- )'
127
118
128
- wait_for_uri http://127.0.0.1:8094/api/index 403
119
+ echo " Adding document to test bucket with curl"
120
+ curl_check -u Administrator:password -X POST http://127.0.0.1:8093/query/service -d @/opt/couchbase/create-document.txt
121
+ rm /opt/couchbase/create-document.txt
122
+ echo
129
123
130
124
echo " Creating test FTS index with curl"
125
+ wait_for_uri http://127.0.0.1:8094/api/index 403
131
126
curl_check -u Administrator:password -X PUT http://127.0.0.1:8094/api/index/test -H Content-Type:application/json -d @/opt/couchbase/create-index.json
132
127
rm /opt/couchbase/create-index.json
133
128
echo
@@ -137,11 +132,11 @@ curl_check -u Administrator:password -X PUT http://127.0.0.1:8092/datadog-test/_
137
132
rm /opt/couchbase/create-ddoc.json
138
133
echo
139
134
140
- echo " Creating RBAC 'admin' user on datadog-test bucket "
141
- couchbase_cli_check user-manage --set \
142
- --rbac-username admin --rbac-password password \
143
- --roles ' bucket_full_access[datadog-test] ' --auth-domain local \
144
- -c 127.0.0.1 -u Administrator -p password
135
+ echo " Creating datatest analytics dataset "
136
+ wait_for_uri_with_auth http://127.0.0.1:8095/query/service 405
137
+ sleep 3
138
+ curl_check -u Administrator:password -X POST http://127.0.0.1:8095/query/service -H Content-Type:application/json -d @/opt/couchbase/create-dataset.json
139
+ rm /opt/couchbase/create-dataset.json
145
140
echo
146
141
147
142
echo " Configuration completed!" | tee /dev/fd/3
0 commit comments