Merge lp://qastaging/~thisfred/desktopcouch/fix_tests_yet_again into lp://qastaging/desktopcouch

Proposed by Eric Casteleijn
Status: Merged
Approved by: John O'Brien
Approved revision: 58
Merged at revision: not available
Proposed branch: lp://qastaging/~thisfred/desktopcouch/fix_tests_yet_again
Merge into: lp://qastaging/desktopcouch
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~thisfred/desktopcouch/fix_tests_yet_again
Reviewer Review Type Date Requested Status
John O'Brien (community) Approve
Facundo Batista (community) Approve
Review via email: mp+11488@code.qastaging.launchpad.net

Commit message

Correctly chains .ini files, and fix one test that talked to the system couchdb on port 5984.

To post a comment you must log in.
Revision history for this message
Eric Casteleijn (thisfred) wrote :

This corrects the command line switches to chain the ini files correctly. Turns out that was never done correctly before. That's ok because this made us find a bug in couchdb itself. This code should work with the current version of couchdb, although it may not yet do the right thing completely. For that we need a newer version of the 0.10 branch of couchdb packaged which has a fix.

I also made the create contacts script talk to desktopcouch instead of the system couchdb.

Revision history for this message
Facundo Batista (facundo) wrote :

Looks ok, but you should place a comment in the import/reload stuff in __init__.py

review: Approve
Revision history for this message
Eric Casteleijn (thisfred) wrote :

> Looks ok, but you should place a comment in the import/reload stuff in
> __init__.py

thanks will do!

Revision history for this message
John O'Brien (jdobrien) :
review: Approve
59. By Eric Casteleijn

added a comment

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'desktopcouch/__init__.py'
--- desktopcouch/__init__.py 2009-09-01 00:38:53 +0000
+++ desktopcouch/__init__.py 2009-09-09 23:24:53 +0000
@@ -16,7 +16,7 @@
16"Desktop Couch helper files"16"Desktop Couch helper files"
1717
18from __future__ import with_statement18from __future__ import with_statement
19import os, re, time19import os, re
20from desktopcouch.start_local_couchdb import process_is_couchdb, read_pidfile20from desktopcouch.start_local_couchdb import process_is_couchdb, read_pidfile
2121
22def find_pid(start_if_not_running=True):22def find_pid(start_if_not_running=True):
2323
=== modified file 'desktopcouch/contacts/testing/create.py'
--- desktopcouch/contacts/testing/create.py 2009-09-04 08:59:18 +0000
+++ desktopcouch/contacts/testing/create.py 2009-09-09 23:24:53 +0000
@@ -22,6 +22,7 @@
22import random, string, uuid22import random, string, uuid
2323
24from couchdb import Server24from couchdb import Server
25import desktopcouch
2526
26CONTACT_DOCTYPE = 'http://www.freedesktop.org/wiki/Specifications/desktopcouch/contact'27CONTACT_DOCTYPE = 'http://www.freedesktop.org/wiki/Specifications/desktopcouch/contact'
27COUCHDB_SYS_PORT = 598428COUCHDB_SYS_PORT = 5984
@@ -158,9 +159,12 @@
158 return fielddict159 return fielddict
159160
160def create_many_contacts(161def create_many_contacts(
161 num_contacts=10, host='localhost', port=COUCHDB_SYS_PORT,162 num_contacts=10, host='localhost', port=None,
162 db_name='contacts', doctype=CONTACT_DOCTYPE, app_annots=None):163 db_name='contacts', doctype=CONTACT_DOCTYPE, app_annots=None):
163 """Make many contacts and create their records"""164 """Make many contacts and create their records"""
165 if port is None:
166 desktopcouch.find_pid()
167 port = desktopcouch.find_port()
164 server_url = 'http://%s:%s/' % (host, port)168 server_url = 'http://%s:%s/' % (host, port)
165 server = Server(server_url)169 server = Server(server_url)
166 db = server[db_name] if db_name in server else server.create(db_name)170 db = server[db_name] if db_name in server else server.create(db_name)
167171
=== modified file 'desktopcouch/local_files.py'
--- desktopcouch/local_files.py 2009-09-02 15:28:28 +0000
+++ desktopcouch/local_files.py 2009-09-09 23:24:53 +0000
@@ -67,7 +67,8 @@
67 import distutils.version67 import distutils.version
68 if distutils.version.LooseVersion(couchversion) >= \68 if distutils.version.LooseVersion(couchversion) >= \
69 distutils.version.LooseVersion('0.10'):69 distutils.version.LooseVersion('0.10'):
70 chain = '-a'70 # XXX: hardcoded path, won't work when couch is somewhere else.
71 chain = '-n -a /etc/couchdb/default.ini -a'
71 else:72 else:
72 chain = '-C'73 chain = '-C'
7374
@@ -78,7 +79,8 @@
78 super(Exception, self).__init__()79 super(Exception, self).__init__()
79 self.file_name = file_name80 self.file_name = file_name
80 def __str__(self):81 def __str__(self):
81 return "OAuth details were not found in the ini file (%s)" % self.file_name82 return "OAuth details were not found in the ini file (%s)" % (
83 self.file_name)
8284
83def get_oauth_tokens(config_file_name=FILE_INI):85def get_oauth_tokens(config_file_name=FILE_INI):
84 """Return the OAuth tokens from the desktop Couch ini file.86 """Return the OAuth tokens from the desktop Couch ini file.
@@ -136,4 +138,3 @@
136# You will need to add -b or -k on the end of this138# You will need to add -b or -k on the end of this
137COUCH_EXEC_COMMAND = [COUCH_EXE, couch_chain_flag(), FILE_INI, '-p', FILE_PID,139COUCH_EXEC_COMMAND = [COUCH_EXE, couch_chain_flag(), FILE_INI, '-p', FILE_PID,
138 '-o', FILE_STDOUT, '-e', FILE_STDERR]140 '-o', FILE_STDOUT, '-e', FILE_STDERR]
139
140141
=== modified file 'desktopcouch/records/server.py'
--- desktopcouch/records/server.py 2009-09-01 15:12:14 +0000
+++ desktopcouch/records/server.py 2009-09-09 23:24:53 +0000
@@ -247,7 +247,7 @@
247 """247 """
248 view_name = "get_records_and_type"248 view_name = "get_records_and_type"
249 view_map_js = """249 view_map_js = """
250 function(doc) { 250 function(doc) {
251 try {251 try {
252 if (! doc['application_annotations']['Ubuntu One']252 if (! doc['application_annotations']['Ubuntu One']
253 ['private_application_annotations']['deleted']) {253 ['private_application_annotations']['deleted']) {
254254
=== modified file 'desktopcouch/tests/__init__.py'
--- desktopcouch/tests/__init__.py 2009-09-03 14:24:06 +0000
+++ desktopcouch/tests/__init__.py 2009-09-09 23:24:53 +0000
@@ -33,4 +33,5 @@
3333
34import xdg.BaseDirectory34import xdg.BaseDirectory
35reload(xdg.BaseDirectory)35reload(xdg.BaseDirectory)
3636from desktopcouch import local_files
37reload(local_files)
3738
=== modified file 'desktopcouch/tests/test_start_local_couchdb.py'
--- desktopcouch/tests/test_start_local_couchdb.py 2009-09-02 22:15:09 +0000
+++ desktopcouch/tests/test_start_local_couchdb.py 2009-09-09 23:24:53 +0000
@@ -71,7 +71,6 @@
7171
72 def setUp(self):72 def setUp(self):
73 # create temp folder with databases and design documents in73 # create temp folder with databases and design documents in
74 os.mkdir(os.path.join(xdg_data, "desktop-couch"))
75 for d in DIRS:74 for d in DIRS:
76 os.mkdir(os.path.join(xdg_data, "desktop-couch", d))75 os.mkdir(os.path.join(xdg_data, "desktop-couch", d))
77 for f, data in FILES.items():76 for f, data in FILES.items():

Subscribers

People subscribed via source and target branches