summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-08-28 15:31:35 -0400
committerBen Morrison <ben@gbmor.dev>2019-08-28 15:31:35 -0400
commit251f72e29ee333196c31224f506649dbfc15cc41 (patch)
tree57eee3050f190e33db5581127c00319f181eed1f /src
parent929b5dc0e3c01bb6c9ca4002c6b907dae508ec23 (diff)
downloadclinte-251f72e29ee333196c31224f506649dbfc15cc41.tar.gz
db tests are on separate path
Diffstat (limited to 'src')
-rw-r--r--src/db.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/db.rs b/src/db.rs
index a63c64a..f892c10 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -18,11 +18,11 @@ pub struct Conn {
 }
 
 impl Conn {
-    fn init() -> rusqlite::Connection {
+    fn init(path: &str) -> rusqlite::Connection {
         let start = time::Instant::now();
         info!("Connecting to database");
         let conn = rusqlite::Connection::open_with_flags(
-            DB_PATH,
+            path,
             rusqlite::OpenFlags::SQLITE_OPEN_FULL_MUTEX
                 | rusqlite::OpenFlags::SQLITE_OPEN_CREATE
                 | rusqlite::OpenFlags::SQLITE_OPEN_READ_WRITE,
@@ -49,7 +49,9 @@ impl Conn {
     }
 
     pub fn new() -> Self {
-        Conn { conn: Conn::init() }
+        Conn {
+            conn: Conn::init(DB_PATH),
+        }
     }
 }
 
@@ -59,7 +61,7 @@ mod tests {
 
     #[test]
     fn test_new() {
-        let conn = Conn::init();
+        let conn = Conn::init("/tmp/clinte-test.db");
         let mut stmt = conn.prepare("SELECT * FROM POSTS").unwrap();
 
         stmt.query_map(rusqlite::NO_PARAMS, |row| Ok(()));
Ben Morrison <ben@gbmor.dev> 2019-06-09 23:26:30 -0400 setting version via build flags' href='/gbmor/getwtxt/commit/svc/init.go?h=v0.4.12&id=45d67236e16365e0c6ea90e9b8baa3008d50996d'>45d6723 ^
c5cf0e1 ^
cf6c849 ^
8630499 ^
cf6c849 ^
6dad137 ^


a0be15e ^

fdd9bd0 ^
cd635e6 ^
06cffd8 ^
fdd9bd0 ^
85f6000 ^
06cffd8 ^
fb32863 ^
887c25e ^
fb32863 ^



fdd9bd0 ^

bd23ef0 ^
fdd9bd0 ^
e34697c ^
920306c ^
fdd9bd0 ^
37142b5 ^
efa99ed ^
fdd9bd0 ^
7410b8c ^
7410b8c ^

df1d1ef ^
fdd9bd0 ^

4695425 ^
2b0d4a5 ^
e53b843 ^

6c1b09b ^





e53b843 ^
6c1b09b ^





6753171 ^



f2d85b6 ^
1f8b2ce ^
fdd9bd0 ^
06cffd8 ^
06cffd8 ^
c896e6b ^
e34697c ^
fdd9bd0 ^

7410b8c ^
fdd9bd0 ^
06cffd8 ^

e53b843 ^
f2d85b6 ^
1f8b2ce ^
f2d85b6 ^




bd23ef0 ^

f2d85b6 ^
67864b2 ^
cf6c849 ^





f2d85b6 ^

5310d08 ^







df8fa27 ^
887c25e ^
df8fa27 ^



fdd9bd0 ^

c896e6b ^
42a3e8a ^

cd635e6 ^
85f6000 ^
5310d08 ^
cd635e6 ^
42a3e8a ^
b29e1c1 ^
d083ce6 ^
efa99ed ^

c896e6b ^
5310d08 ^



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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159