I have a unit test checking my replication set-up that's oddly failing every other time I run it. It sets up a continuous replication between a touchDb database and a couchdb instance on my test server Every time, upon running, I delete and recreate the databases and the replication. I'm using CouchServer and the CouchCocoa API to access the test server and create the remote db. The test consistently fails every other time it is run. When it doesn't work, I notice the following warning in the log
WARNING: CouchPersistentReplication[0165..BE08]: Save failed: Error Domain=CouchDB Code=404 "The operation couldn’t be completed. not_found" UserInfo=0x128691b0 {NSUnderlyingError=0x12868ca0 "not found", NSLocalizedFailureReason=not_found}
I debugged through and saw that for the times where it doesn't work, there is already a matching Replication document on the server (see the replicationWithSource: target: method in CouchServer). It returns the matching document rather than creating a new one. To try and avoid this, I modified the test to explicitly delete the replication document, but I get the following similar error
2012-10-24 23:43:31.092 KiddieNotes[46483:11603] WARNING: CouchPersistentReplication[12F6..4749]: DELETE failed, Error Domain=CouchDB Code=404 "The operation couldn’t be completed. not_found" UserInfo=0x7571150 {NSUnderlyingError=0x7570a60 "not found", NSLocalizedFailureReason=not_found}
Any ideas on a) why this replication document isn't cleaned up some of the time and b) what this error means? Seems like the document doesn't actually exist in the database but exists in memory? Is that possible?
Thanks!
Bill