codemusings commented on issue #1083: GET _index does not immediately return 
indexes created with POST _index
URL: https://github.com/apache/couchdb/issues/1083#issuecomment-355553650
 
 
   I have a very similar problem with unit testing right now. I think it's the 
same underlying issue as well.
   
   I've configured my CouchDB as a single node instance and enbabled 
`couch_peruser`. My tests for adding a user and writing a document to the 
respective user database sometimes works and sometimes fails. There seems to be 
a delay between the `201 Created` for the user and being able to write to the 
user's database.
   
   Is this intentionally? What's the best practive here? Of course I could just 
skip the tests, but I also want to integrate this into an automated workflow 
where I need to be sure this works reliably.
   
   Are we supposed to make HEAD requests until we get a `200` for the user's 
database?
   
   I'm using CouchDB 2.1.1 on Ubuntu 16.04. (Erlang 18.1). I can reliably 
reproduce the issue by chaining the following curl commands:
   
   ```bash
   curl -u admin:secret -X PUT -H "Content-Type: application/json" -d 
'{"name":"[email protected]","password":"abc","type":"user","roles":[]}' 
couchhost:5984/_users/org.couchdb.user:[email protected] \
       && curl -u admin:secret -H "Content-Type: application/json" -d 
'{"field":"value"}' couchhost:5984/userdb-6a6f686e646f65406d61696c2e636f6d
   ```
   
   I can also reliably write to it afterwards using the second curl command 
again: 
   
   ```bash
   curl -u admin:secret -H "Content-Type: application/json" -d 
'{"field":"value"}' couchhost:5984/userdb-6a6f686e646f65406d61696c2e636f6d
   ```
   
   `6a6f686e646f65406d61696c2e636f6d` being the hex representation of 
`[email protected]`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to