Skip to content

Commit ee4ce3a

Browse files
committed
amend Go, client, and Dockerfile testing
1 parent cb5d0fe commit ee4ce3a

14 files changed

Lines changed: 112 additions & 106 deletions

testing/PostgresDockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ RUN gem install bundler -v 2.1.4 && bundle install
7979

8080
# install doltgres from source
8181
WORKDIR /root/building
82-
COPY ./ ./doltgresql
82+
COPY go.mod doltgresql/
83+
# download dependencies first to persist Go dependencies download cache for doltgres despite other edits
84+
WORKDIR doltgresql
85+
RUN go mod download
86+
# exclude clients directory to persist build-cache for doltgres when only editing client code
87+
COPY --exclude=testing/postgres-client-tests/ . .
8388

8489
# Build the parser
8590
WORKDIR /root/building/doltgresql/postgres/parser

testing/go/as_of_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ func TestAsOf(t *testing.T) {
2727
SetUpScript: []string{
2828
`CREATE TABLE test (a INT)`,
2929
`INSERT INTO test VALUES (1)`,
30-
`CALL DOLT_COMMIT('-Am', 'new table')`,
30+
`SELECT DOLT_COMMIT('-Am', 'new table')`,
3131
`INSERT INTO test VALUES (2)`,
32-
`CALL DOLT_COMMIT('-am', 'new row')`,
32+
`SELECT DOLT_COMMIT('-am', 'new row')`,
3333
},
3434
Assertions: []ScriptTestAssertion{
3535
{
@@ -52,14 +52,14 @@ func TestAsOf(t *testing.T) {
5252
SetUpScript: []string{
5353
`CREATE TABLE test (a INT)`,
5454
`INSERT INTO test VALUES (1)`,
55-
`CALL DOLT_COMMIT('-Am', 'new table')`,
55+
`SELECT DOLT_COMMIT('-Am', 'new table')`,
5656
`INSERT INTO test VALUES (2)`,
57-
`CALL DOLT_COMMIT('-am', 'new row')`,
57+
`SELECT DOLT_COMMIT('-am', 'new row')`,
5858
`CREATE TABLE test2 (b INT)`,
5959
`INSERT INTO test2 VALUES (1)`,
60-
`CALL DOLT_COMMIT('-Am', 'new table')`,
60+
`SELECT DOLT_COMMIT('-Am', 'new table')`,
6161
`INSERT INTO test2 VALUES (2)`,
62-
`CALL DOLT_COMMIT('-am', 'new row')`,
62+
`SELECT DOLT_COMMIT('-am', 'new row')`,
6363
},
6464
Assertions: []ScriptTestAssertion{
6565
{
@@ -100,14 +100,14 @@ func TestAsOf(t *testing.T) {
100100
SetUpScript: []string{
101101
`CREATE TABLE test (a INT)`,
102102
`INSERT INTO test VALUES (1)`,
103-
`CALL DOLT_COMMIT('-Am', 'new table')`,
103+
`SELECT DOLT_COMMIT('-Am', 'new table')`,
104104
`INSERT INTO test VALUES (2)`,
105-
`CALL DOLT_COMMIT('-am', 'new row')`,
105+
`SELECT DOLT_COMMIT('-am', 'new row')`,
106106
`CREATE TABLE test2 (b INT)`,
107107
`INSERT INTO test2 VALUES (1)`,
108-
`CALL DOLT_COMMIT('-Am', 'new table')`,
108+
`SELECT DOLT_COMMIT('-Am', 'new table')`,
109109
`INSERT INTO test2 VALUES (2)`,
110-
`CALL DOLT_COMMIT('-am', 'new row')`,
110+
`SELECT DOLT_COMMIT('-am', 'new row')`,
111111
},
112112
Assertions: []ScriptTestAssertion{
113113
{

testing/go/foreign_keys_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ func TestForeignKeys(t *testing.T) {
510510
"create schema parent",
511511
"create schema child",
512512
"create schema fake",
513-
"call dolt_commit('-Am', 'create schemas')",
513+
"select dolt_commit('-Am', 'create schemas')",
514514
"set search_path to 'parent, child'",
515515
`create table parent.parent (pk int, val int, primary key(pk));`,
516516
`create table fake.parent (pk int, val int, primary key(pk));`,
@@ -561,7 +561,7 @@ func TestForeignKeys(t *testing.T) {
561561
"create schema parent",
562562
"create schema child",
563563
"create schema fake",
564-
"call dolt_commit('-Am', 'create schemas')",
564+
"select dolt_commit('-Am', 'create schemas')",
565565
"set search_path to 'child, fake'",
566566
`create table parent.parent (pk int, val int, primary key(pk));`,
567567
`create table fake.parent (pk int, val int, primary key(pk));`,
@@ -612,7 +612,7 @@ func TestForeignKeys(t *testing.T) {
612612
"create schema parent",
613613
"create schema child",
614614
"create schema fake",
615-
"call dolt_commit('-Am', 'create schemas')",
615+
"select dolt_commit('-Am', 'create schemas')",
616616
`create table parent.parent (pk int, val int, primary key(pk));`,
617617
`create table fake.parent (pk int, val int, primary key(pk));`,
618618
"CREATE TABLE child.child (id int, info varchar(255), test_pk int, primary key(id), foreign key (test_pk) references parent.parent(pk))",
@@ -662,7 +662,7 @@ func TestForeignKeys(t *testing.T) {
662662
"create schema parent",
663663
"create schema child",
664664
"create schema fake",
665-
"call dolt_commit('-Am', 'create schemas')",
665+
"select dolt_commit('-Am', 'create schemas')",
666666
"set search_path to 'child, parent'",
667667
`create table parent.parent (pk int, val int, primary key(pk));`,
668668
`create table fake.parent (pk int, val int, primary key(pk));`,
@@ -697,7 +697,7 @@ func TestForeignKeys(t *testing.T) {
697697
"create schema parent",
698698
"create schema child",
699699
"create schema fake",
700-
"call dolt_commit('-Am', 'create schemas')",
700+
"select dolt_commit('-Am', 'create schemas')",
701701
"set search_path to 'child, fake'",
702702
`create table parent.parent (pk int, val int, primary key(pk));`,
703703
`create table fake.parent (pk int, val int, primary key(pk));`,
@@ -732,7 +732,7 @@ func TestForeignKeys(t *testing.T) {
732732
"create schema parent",
733733
"create schema child",
734734
"create schema fake",
735-
"call dolt_commit('-Am', 'create schemas')",
735+
"select dolt_commit('-Am', 'create schemas')",
736736
`create table parent.parent (pk int, val int, primary key(pk));`,
737737
`create table fake.parent (pk int, val int, primary key(pk));`,
738738
"CREATE TABLE child.child (id int, info varchar(255), test_pk int, primary key(id))",
@@ -766,7 +766,7 @@ func TestForeignKeys(t *testing.T) {
766766
"create schema parent",
767767
"create schema child",
768768
"create schema fake",
769-
"call dolt_commit('-Am', 'create schemas')",
769+
"select dolt_commit('-Am', 'create schemas')",
770770
"set search_path to 'child, parent'",
771771
`create table parent.parent (pk int, val int, primary key(pk));`,
772772
`create table fake.parent (pk int, val int, primary key(pk));`,
@@ -798,7 +798,7 @@ func TestForeignKeys(t *testing.T) {
798798
"create schema parent",
799799
"create schema child",
800800
"create schema fake",
801-
"call dolt_commit('-Am', 'create schemas')",
801+
"select dolt_commit('-Am', 'create schemas')",
802802
`create table parent.parent (pk int, val int, primary key(pk));`,
803803
`create table fake.parent (pk int, val int, primary key(pk));`,
804804
"CREATE TABLE child.child (id int, info varchar(255), test_pk int, primary key(id))",

testing/go/getting_started_guide_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func TestGettingStartedGuide(t *testing.T) {
4242
},
4343
},
4444
{
45-
Query: "call dolt_add('teams', 'employees', 'employees_teams');",
46-
Expected: []sql.Row{},
45+
Query: "select dolt_add('teams', 'employees', 'employees_teams');",
46+
Expected: []sql.Row{{"{0}"}},
4747
},
4848
{
4949
Query: "select * from dolt.status;",
@@ -54,17 +54,17 @@ func TestGettingStartedGuide(t *testing.T) {
5454
},
5555
},
5656
{
57-
Query: "call dolt_commit('-m', 'Created initial schema');",
58-
Expected: []sql.Row{},
57+
Query: "select length(dolt_commit('-m', 'Created initial schema')::text);",
58+
Expected: []sql.Row{{34}},
5959
},
6060
{
6161
// TODO: employees_teams is still marked as modified even though we staged and committed it. The diff
6262
// in the working set shows a schema change of adding the FK references. For now, we reset to
6363
// remove this artifact and prevent it from showing up in later test assertions, but this can
6464
// be removed once the issue is fixed.
6565
// https://github.com/dolthub/doltgresql/issues/734
66-
Query: "call dolt_reset('--hard');",
67-
Expected: []sql.Row{},
66+
Query: "select dolt_reset('--hard');",
67+
Expected: []sql.Row{{"{0}"}},
6868
},
6969
{
7070
Query: "select * from dolt.status;",
@@ -123,8 +123,8 @@ func TestGettingStartedGuide(t *testing.T) {
123123
},
124124
},
125125
{
126-
Query: "call dolt_commit('-am', 'Populated tables with data');",
127-
Expected: []sql.Row{},
126+
Query: "select length(dolt_commit('-am', 'Populated tables with data')::text);",
127+
Expected: []sql.Row{{34}},
128128
},
129129
{
130130
Query: "select * from dolt.status order by table_name;",
@@ -161,8 +161,8 @@ func TestGettingStartedGuide(t *testing.T) {
161161
ExpectedErr: "table not found: employees_teams",
162162
},
163163
{
164-
Query: "call dolt_reset('--hard');",
165-
Expected: []sql.Row{},
164+
Query: "select dolt_reset('--hard');",
165+
Expected: []sql.Row{{"{0}"}},
166166
},
167167
{
168168
Query: "select count(*) from employees_teams;",
@@ -171,8 +171,8 @@ func TestGettingStartedGuide(t *testing.T) {
171171

172172
// Make changes on a branch
173173
{
174-
Query: "call dolt_checkout('-b','modifications');",
175-
Expected: []sql.Row{},
174+
Query: "select dolt_checkout('-b','modifications');",
175+
Expected: []sql.Row{{"{0,\"Switched to branch 'modifications'\"}"}},
176176
},
177177
{
178178
Query: "update employees SET first_name='Timothy' where first_name='Tim';",
@@ -191,12 +191,12 @@ func TestGettingStartedGuide(t *testing.T) {
191191
Expected: []sql.Row{},
192192
},
193193
{
194-
Query: "call dolt_commit('-am', 'Modifications on a branch');",
195-
Expected: []sql.Row{},
194+
Query: "select length(dolt_commit('-am', 'Modifications on a branch')::text);",
195+
Expected: []sql.Row{{34}},
196196
},
197197
{
198-
Query: "call dolt_checkout('main');",
199-
Expected: []sql.Row{},
198+
Query: "select dolt_checkout('main');",
199+
Expected: []sql.Row{{"{0,\"Switched to branch 'main'\"}"}},
200200
},
201201
{
202202
Query: "select name, latest_commit_message from dolt.branches;",
@@ -230,8 +230,8 @@ func TestGettingStartedGuide(t *testing.T) {
230230
// Make a schema change on another branch
231231
// TODO: Most ALTER TABLE statements aren't supported yet
232232
{
233-
Query: "call dolt_checkout('-b', 'schema_changes');",
234-
Expected: []sql.Row{},
233+
Query: "select dolt_checkout('-b', 'schema_changes');",
234+
Expected: []sql.Row{{"{0,\"Switched to branch 'schema_changes'\"}"}},
235235
},
236236
},
237237
},

testing/go/issues_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 Dolthub, Inc.
1+
/// Copyright 2023 Dolthub, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -30,28 +30,28 @@ func TestIssues(t *testing.T) {
3030
},
3131
Assertions: []ScriptTestAssertion{
3232
{
33-
Query: `call dolt_add(".");`,
33+
Query: `select dolt_add(".");`,
3434
ExpectedErr: "could not be found in any table in scope",
3535
},
3636
{
37-
Query: `call dolt_add('.');`,
38-
SkipResultsCheck: true,
37+
Query: `select dolt_add('.');`,
38+
Expected: []sql.Row{{"{0}"}},
3939
},
4040
{
41-
Query: `call dolt_commit("-m", "look ma");`,
41+
Query: `select dolt_commit("-m", "look ma");`,
4242
ExpectedErr: "could not be found in any table in scope",
4343
},
4444
{
45-
Query: `call dolt_commit('-m', 'look ma');`,
46-
SkipResultsCheck: true,
45+
Query: `select length(dolt_commit('-m', 'look ma')::text);`,
46+
Expected: []sql.Row{{34}},
4747
},
4848
{
49-
Query: `call dolt_branch("br1");`,
49+
Query: `select dolt_branch("br1");`,
5050
ExpectedErr: "could not be found in any table in scope",
5151
},
5252
{
53-
Query: `call dolt_branch('br1');`,
54-
SkipResultsCheck: true,
53+
Query: `select dolt_branch('br1');`,
54+
Expected: []sql.Row{{"{0}"}},
5555
},
5656
},
5757
},

testing/go/schemas_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,22 +652,23 @@ var SchemaTests = []ScriptTest{
652652
{
653653
Name: "merge new table in new schema",
654654
SetUpScript: []string{
655-
"call dolt_checkout('-b', 'branch1')",
655+
"select dolt_checkout('-b', 'branch1')",
656656
"CREATE SCHEMA branchschema",
657657
"Create table branchschema.mytbl (pk BIGINT PRIMARY KEY, v1 BIGINT);",
658658
"INSERT INTO branchschema.mytbl VALUES (1, 1), (2, 2)",
659659
"Create table branchschema.mytbl2 (pk BIGINT PRIMARY KEY, v1 BIGINT);",
660660
"INSERT INTO branchschema.mytbl2 VALUES (3, 3), (4, 4)",
661661
"select dolt_commit('-Am', 'new table in new schema')",
662-
"call dolt_checkout('main')",
662+
"select dolt_checkout('main')",
663663
"create schema mainschema",
664664
"create table mainschema.maintable (pk BIGINT PRIMARY KEY, v1 BIGINT);",
665665
"insert into mainschema.maintable values (5, 5), (6, 6)",
666666
"select dolt_commit('-Am', 'new table in main')",
667667
},
668668
Assertions: []ScriptTestAssertion{
669669
{
670-
Query: "call dolt_merge('branch1')",
670+
Query: "select length(dolt_merge('branch1')::text)",
671+
Expected: []sql.Row{{57}},
671672
},
672673
{
673674
Query: "SELECT * from mainschema.maintable",

testing/go/show_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ func TestDescribe(t *testing.T) {
6969
Name: "describe table AS OF",
7070
SetUpScript: []string{
7171
`CREATE TABLE t1 (id INT PRIMARY KEY, name TEXT)`,
72-
`call dolt_commit('-Am', 'first commit')`,
72+
`select dolt_commit('-Am', 'first commit')`,
7373
`ALTER TABLE t1 ADD COLUMN age INT`,
74-
`call dolt_commit('-am', 'second commit')`,
74+
`select dolt_commit('-am', 'second commit')`,
7575
`ALTER TABLE t1 ADD COLUMN height INT`,
7676
},
7777
Assertions: []ScriptTestAssertion{

testing/go/smoke_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ func TestSmokeTests(t *testing.T) {
182182
"USE test",
183183
"CREATE TABLE t1 (pk BIGINT PRIMARY KEY, v1 BIGINT);",
184184
"INSERT INTO t1 VALUES (1, 1), (2, 2);",
185-
"call dolt_commit('-Am', 'initial commit');",
186-
"call dolt_branch('b1');",
187-
"call dolt_checkout('b1');",
185+
"select dolt_commit('-Am', 'initial commit');",
186+
"select dolt_branch('b1');",
187+
"select dolt_checkout('b1');",
188188
"INSERT INTO t1 VALUES (3, 3), (4, 4);",
189-
"call dolt_commit('-Am', 'commit b1');",
190-
"call dolt_tag('tag1')",
189+
"select dolt_commit('-Am', 'commit b1');",
190+
"select dolt_tag('tag1')",
191191
"INSERT INTO t1 VALUES (5, 5), (6, 6);",
192-
"call dolt_checkout('main');",
192+
"select dolt_checkout('main');",
193193
},
194194
Assertions: []ScriptTestAssertion{
195195
{
@@ -262,21 +262,21 @@ func TestSmokeTests(t *testing.T) {
262262
SetUpScript: []string{
263263
"CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 BIGINT);",
264264
"INSERT INTO test VALUES (1, 1), (2, 2);",
265-
"CALL DOLT_ADD('-A');",
266-
"CALL DOLT_COMMIT('-m', 'initial commit');",
267-
"CALL DOLT_BRANCH('other');",
265+
"SELECT DOLT_ADD('-A');",
266+
"SELECT DOLT_COMMIT('-m', 'initial commit');",
267+
"SELECT DOLT_BRANCH('other');",
268268
"UPDATE test SET v1 = 3;",
269-
"CALL DOLT_ADD('-A');",
270-
"CALL DOLT_COMMIT('-m', 'commit main');",
271-
"CALL DOLT_CHECKOUT('other');",
269+
"SELECT DOLT_ADD('-A');",
270+
"SELECT DOLT_COMMIT('-m', 'commit main');",
271+
"SELECT DOLT_CHECKOUT('other');",
272272
"UPDATE test SET v1 = 4 WHERE pk = 2;",
273-
"CALL DOLT_ADD('-A');",
274-
"CALL DOLT_COMMIT('-m', 'commit other');",
273+
"SELECT DOLT_ADD('-A');",
274+
"SELECT DOLT_COMMIT('-m', 'commit other');",
275275
},
276276
Assertions: []ScriptTestAssertion{
277277
{
278-
Query: "CALL DOLT_CHECKOUT('main');",
279-
SkipResultsCheck: true,
278+
Query: "SELECT DOLT_CHECKOUT('main');",
279+
Expected: []sql.Row{{"{0,\"Switched to branch 'main'\"}"}},
280280
},
281281
{
282282
Query: "SELECT * FROM test;",
@@ -286,8 +286,8 @@ func TestSmokeTests(t *testing.T) {
286286
},
287287
},
288288
{
289-
Query: "CALL DOLT_CHECKOUT('other');",
290-
SkipResultsCheck: true,
289+
Query: "SELECT DOLT_CHECKOUT('other');",
290+
Expected: []sql.Row{{"{0,\"Switched to branch 'other'\"}"}},
291291
},
292292
{
293293
Query: "SELECT * FROM test;",

testing/postgres-client-tests/c/postgres-c-connector-test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ char *queries[QUERIES_SIZE] = {
1111
"select * from test",
1212
"insert into test (pk, value, d1, f1, c1, t1) values (0,0,0.0,0.0,'abc','a1')",
1313
"select * from test",
14-
"call dolt_add('-A');",
15-
"call dolt_commit('-m', 'my commit')",
14+
"select dolt_add('-A');",
15+
"select dolt_commit('-m', 'my commit')",
1616
"select COUNT(*) FROM dolt.log",
17-
"call dolt_checkout('-b', 'mybranch')",
17+
"select dolt_checkout('-b', 'mybranch')",
1818
"insert into test (pk, value, d1, f1, c1, t1) values (10,10, 123456.789, 420.42,'example','some text')",
19-
"call dolt_commit('-a', '-m', 'my commit2')",
20-
"call dolt_checkout('main')",
21-
"call dolt_merge('mybranch')",
19+
"select dolt_commit('-a', '-m', 'my commit2')",
20+
"select dolt_checkout('main')",
21+
"select dolt_merge('mybranch')",
2222
"select COUNT(*) FROM dolt.log",
2323
};
2424

0 commit comments

Comments
 (0)