-
Notifications
You must be signed in to change notification settings - Fork 1
/
ckan-testing-setup.txt
89 lines (51 loc) · 2.27 KB
/
ckan-testing-setup.txt
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
This document covers how we set up the ckan test suite. It is based on this:
http://docs.ckan.org/en/ckan-2.6.0/contributing/test.html
####
# Utility scripts
####
See ckan-tests-bin.zip for utility scripts. Put these scripts into the ubuntu user's ~/bin.
####
# Configure test-core.ini
###
They mention development.ini, but they seem to want to use test-core.ini so
Update /usr/lib/ckan/default/src/ckan/test-core.ini:
sqlalchemy.url to ckan_test
ckan.datastore.write_url to ckan_test
ckan.datastore.read_url to datastore_test
solr_url to the solr dev instance, in our case it's the one in /etc/ckan/default/production.ini
######
# Install packages we need to run tests
#####
Need to be root to install packages (well, you could probably do this sudo -H, but moving along...)
sudo su -
. /usr/lib/ckan/default/bin/activate
pip install -r /usr/lib/ckan/default/src/ckan/dev-requirements.txt
Running that gave me a couple 'SyntaxError: invalid syntax' but I ran the command again
and it seemed happy, so moving on...
#######
# Create test tables
#######
To make working with the databases easier (don't have to type passwords) make a
~.pgppass file
#hostname:port:database:username:password
There's a script you can use ~/bin/drpsql
to make connecting to the postgres instances a little easier, eg `drpsql ckan_default` or `drpsql datasotre_default`. If you wanted to
look around on the database.
then:
createdb --host=your-db --port=your-port --username=ckan_default -O ckan_default ckan_test -E utf-8
createdb --host=your-db --port=your-port --username=ckan_default -O ckan_default datastore_test -E utf-8
Then
paster --plugin=ckan datastore set-permissions -c /etc/ckan/default/test-core.ini | drpsql ckan_default
This will give you warnings for DB objects that already have the correct permissions, seems fine.
#####
# Script to run tests
####
Scripts in ~/bin/
run-ckan-tests
run-tests-easy
run-tests-easy calls run-ckan-tests. Use run-tests-easy to run tests like
run-tests-easy output-file.txt
It uses nohup so you can logout and not worry about it.
run-ckan-tests has some tests excluded using the nose -e argument - see comments in run-ckan-tests for why.
If you want to add more tests to the script, you can add them to run-ckan-tests. For example for
new extensions you install.