File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 68
68
build9
69
69
t /servroot /
70
70
buildroot /
71
+ build10
72
+ go
Original file line number Diff line number Diff line change @@ -8,12 +8,19 @@ repeat_each(1);
8
8
plan tests => repeat_each() * blocks();
9
9
10
10
$ENV {TEST_NGINX_MYSQL_PORT } ||= 3306;
11
+ $ENV {TEST_NGINX_POSTGRESQL_PORT } ||= 5432;
11
12
12
13
our $http_config = <<'_EOC_' ;
13
14
upstream database {
14
15
drizzle_server 127.0.0.1:$TEST_NGINX_MYSQL_PORT protocol=mysql
15
16
dbname=ngx_test user=ngx_test password=ngx_test;
16
17
}
18
+
19
+ upstream pg {
20
+ postgres_server 127.0.0.1:$TEST_NGINX_POSTGRESQL_PORT
21
+ dbname=ngx_test user=ngx_test password=ngx_test;
22
+ }
23
+
17
24
_EOC_
18
25
19
26
worker_connections(128);
@@ -77,3 +84,60 @@ GET /init
77
84
GET /init
78
85
--- error_code: 200
79
86
--- timeout: 10
87
+
88
+
89
+
90
+ === TEST 5: cats - drop table - pg
91
+ --- http_config eval: $::http_config
92
+ --- config
93
+ location = /init {
94
+ postgres_pass pg;
95
+ postgres_query "DROP TABLE IF EXISTS cats";
96
+ }
97
+ --- request
98
+ GET /init
99
+ --- error_code: 200
100
+ --- timeout: 10
101
+
102
+
103
+
104
+ === TEST 6: cats - create table - pg
105
+ --- http_config eval: $::http_config
106
+ --- config
107
+ location = /init {
108
+ postgres_pass pg;
109
+ postgres_query "CREATE TABLE cats (id integer, name text)";
110
+ }
111
+ --- request
112
+ GET /init
113
+ --- error_code: 200
114
+ --- timeout: 10
115
+
116
+
117
+
118
+ === TEST 7: cats - insert value - pg
119
+ --- http_config eval: $::http_config
120
+ --- config
121
+ location = /init {
122
+ postgres_pass pg;
123
+ postgres_query "INSERT INTO cats (id) VALUES (2)";
124
+ }
125
+ --- request
126
+ GET /init
127
+ --- error_code: 200
128
+ --- timeout: 10
129
+
130
+
131
+
132
+ === TEST 8: cats - insert value - pg
133
+ --- http_config eval: $::http_config
134
+ --- config
135
+ location = /init {
136
+ postgres_pass pg;
137
+ postgres_query "INSERT INTO cats (id, name) VALUES (3, 'bob')";
138
+ }
139
+ --- request
140
+ GET /init
141
+ --- error_code: 200
142
+ --- timeout: 10
143
+
You can’t perform that action at this time.
0 commit comments