Skip to content

Commit f1fc3fe

Browse files
authored
Merge pull request #1752 from dolthub/timsehn-29131b19
[auto-bump] [no-release-notes] dependency by timsehn
2 parents 2ddc878 + 3fecd92 commit f1fc3fe

File tree

5 files changed

+94
-34
lines changed

5 files changed

+94
-34
lines changed

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ require (
66
github.com/PuerkitoBio/goquery v1.8.1
77
github.com/cockroachdb/apd/v2 v2.0.3-0.20200518165714-d020e156310a
88
github.com/cockroachdb/errors v1.7.5
9-
github.com/dolthub/dolt/go v0.40.5-0.20250811182446-2c9b9a9127fe
9+
github.com/dolthub/dolt/go v0.40.5-0.20250813214627-29131b19a67a
1010
github.com/dolthub/eventsapi_schema v0.0.0-20250725194025-a087efa1ee55
1111
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2
1212
github.com/dolthub/go-icu-regex v0.0.0-20250327004329-6799764f2dad
13-
github.com/dolthub/go-mysql-server v0.20.1-0.20250811061414-a2ed59d23655
13+
github.com/dolthub/go-mysql-server v0.20.1-0.20250813184321-cf94656a252a
1414
github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216
15-
github.com/dolthub/vitess v0.0.0-20250730174048-497aebb8cea7
15+
github.com/dolthub/vitess v0.0.0-20250813175212-45844169a751
1616
github.com/fatih/color v1.13.0
1717
github.com/goccy/go-json v0.10.2
1818
github.com/gogo/protobuf v1.3.2

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh
248248
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
249249
github.com/dolthub/aws-sdk-go-ini-parser v0.0.0-20250305001723-2821c37f6c12 h1:IdqX7J8vi/Kn3T3Ee0VzqnLqwFmgA2hr8WZETPcQjfM=
250250
github.com/dolthub/aws-sdk-go-ini-parser v0.0.0-20250305001723-2821c37f6c12/go.mod h1:rN7X8BHwkjPcfMQQ2QTAq/xM3leUSGLfb+1Js7Y6TVo=
251-
github.com/dolthub/dolt/go v0.40.5-0.20250811182446-2c9b9a9127fe h1:Cqpq7gyLGGqzrD36CAZ5auYUcwbpqLrqfKO++q5kg6A=
252-
github.com/dolthub/dolt/go v0.40.5-0.20250811182446-2c9b9a9127fe/go.mod h1:2E8XHHDqvXliKbaTBEDTtl/yttpTJF81DtQNpxpPW6Y=
251+
github.com/dolthub/dolt/go v0.40.5-0.20250813214627-29131b19a67a h1:dTBa0xFnAwbOJHaoWacYLR335hCoAK2zhRsaw4jJca0=
252+
github.com/dolthub/dolt/go v0.40.5-0.20250813214627-29131b19a67a/go.mod h1:QWwyUREvjch+QKWGWvVA9Di/pP7qjatpuPcQdkbFSgg=
253253
github.com/dolthub/eventsapi_schema v0.0.0-20250725194025-a087efa1ee55 h1:LdtiPD8IJ+M2XckvfQ/aLG34lET1shz+WMccGBhZRLM=
254254
github.com/dolthub/eventsapi_schema v0.0.0-20250725194025-a087efa1ee55/go.mod h1:CoDLfgPqHyBtth0Cp+fi/CmC4R81zJNX4wPjShdZ+Bw=
255255
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 h1:u3PMzfF8RkKd3lB9pZ2bfn0qEG+1Gms9599cr0REMww=
@@ -258,8 +258,8 @@ github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
258258
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
259259
github.com/dolthub/go-icu-regex v0.0.0-20250327004329-6799764f2dad h1:66ZPawHszNu37VPQckdhX1BPPVzREsGgNxQeefnlm3g=
260260
github.com/dolthub/go-icu-regex v0.0.0-20250327004329-6799764f2dad/go.mod h1:ylU4XjUpsMcvl/BKeRRMXSH7e7WBrPXdSLvnRJYrxEA=
261-
github.com/dolthub/go-mysql-server v0.20.1-0.20250811061414-a2ed59d23655 h1:Y+WL+Gz+9sQexf09TrDXDSP4DHNOAvGLeGSt+/f0qZM=
262-
github.com/dolthub/go-mysql-server v0.20.1-0.20250811061414-a2ed59d23655/go.mod h1:bm6qjZ7/4B65nVfGBWKBPz4BsrFKzMxNwsk3c1fasis=
261+
github.com/dolthub/go-mysql-server v0.20.1-0.20250813184321-cf94656a252a h1:+qhCuyzRKdUCv9v6EG1q48jcub/SKWDpLGZ9vh2fBRY=
262+
github.com/dolthub/go-mysql-server v0.20.1-0.20250813184321-cf94656a252a/go.mod h1:nR895qqNcXnySptw6EPmGsUE0fxQA+WIsCtQeXYJe58=
263263
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI=
264264
github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q=
265265
github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718 h1:lT7hE5k+0nkBdj/1UOSFwjWpNxf+LCApbRHgnCA17XE=
@@ -270,8 +270,8 @@ github.com/dolthub/pg_query_go/v6 v6.0.0-20250702135351-29eb6bfc4ea6 h1:UEX3FGaC
270270
github.com/dolthub/pg_query_go/v6 v6.0.0-20250702135351-29eb6bfc4ea6/go.mod h1:nvTHIuoud6e1SfrUaFwHqT0i4b5Nr+1rPWVds3B5+50=
271271
github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 h1:JWkKRE4EHUcEVQCMRBej8DYxjYjRz/9MdF/NNQh0o70=
272272
github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216/go.mod h1:e/FIZVvT2IR53HBCAo41NjqgtEnjMJGKca3Y/dAmZaA=
273-
github.com/dolthub/vitess v0.0.0-20250730174048-497aebb8cea7 h1:l+mWO0xoh4eG1J9gMS87opL6N6WGAQitF36R/Lg4bWs=
274-
github.com/dolthub/vitess v0.0.0-20250730174048-497aebb8cea7/go.mod h1:1gQZs/byeHLMSul3Lvl3MzioMtOW1je79QYGyi2fd70=
273+
github.com/dolthub/vitess v0.0.0-20250813175212-45844169a751 h1:BBQKyvyODewdQxS+ICklMn1d/fFj2pVlkmMN1QFY4ms=
274+
github.com/dolthub/vitess v0.0.0-20250813175212-45844169a751/go.mod h1:1gQZs/byeHLMSul3Lvl3MzioMtOW1je79QYGyi2fd70=
275275
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
276276
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
277277
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=

testing/go/framework.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ import (
5353
// rather than starting a doltgres server.
5454
const runOnPostgres = false
5555

56-
// currentPort is a port number that is currently in use. It's for tests only.
57-
var currentPort = 5432
58-
5956
// ScriptTest defines a consistent structure for testing queries.
6057
type ScriptTest struct {
6158
// Name of the script.
@@ -164,7 +161,6 @@ func RunScript(t *testing.T, script ScriptTest, normalizeRows bool) {
164161
controller.Stop()
165162
err := controller.WaitForStop()
166163
require.NoError(t, err)
167-
currentPort = 5432
168164
}()
169165
}
170166

@@ -339,9 +335,15 @@ func init() {
339335
// when the connection is closed (or loses its connection to the server). The accompanying WaitGroup may be used to wait
340336
// until the server has closed.
341337
func CreateServer(t *testing.T, database string) (context.Context, *Connection, *svcs.Controller) {
342-
require.NotEmpty(t, database)
343338
port := GetUnusedPort(t)
344-
currentPort = port
339+
return CreateServerWithPort(t, database, port)
340+
}
341+
342+
// CreateServerWithPort creates a server with the given database and port, returning a connection to the server. The server will close
343+
// when the connection is closed (or loses its connection to the server). The accompanying WaitGroup may be used to wait
344+
// until the server has closed.
345+
func CreateServerWithPort(t *testing.T, database string, port int) (context.Context, *Connection, *svcs.Controller) {
346+
require.NotEmpty(t, database)
345347
controller, err := dserver.RunInMemory(&servercfg.DoltgresConfig{
346348
ListenerConfig: &servercfg.DoltgresListenerConfig{
347349
PortNumber: &port,
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Copyright 2025 Dolthub, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package _go
16+
17+
import (
18+
"context"
19+
"fmt"
20+
"testing"
21+
22+
"github.com/dolthub/dolt/go/libraries/utils/svcs"
23+
"github.com/dolthub/go-mysql-server/sql"
24+
"github.com/jackc/pgx/v5"
25+
"github.com/stretchr/testify/require"
26+
)
27+
28+
func TestServerConfigVariableStatement(t *testing.T) {
29+
scriptDatabase := "postgres"
30+
var ctx context.Context
31+
var conn *Connection
32+
port := GetUnusedPort(t)
33+
34+
if runOnPostgres {
35+
ctx = context.Background()
36+
pgxConn, err := pgx.Connect(ctx, fmt.Sprintf("postgres://postgres:[email protected]:%d/%s?sslmode=disable", 5432, scriptDatabase))
37+
require.NoError(t, err)
38+
conn = &Connection{
39+
Default: pgxConn,
40+
Current: pgxConn,
41+
}
42+
require.NoError(t, pgxConn.Ping(ctx))
43+
defer func() {
44+
conn.Close(ctx)
45+
}()
46+
} else {
47+
var controller *svcs.Controller
48+
ctx, conn, controller = CreateServerWithPort(t, scriptDatabase, port)
49+
defer func() {
50+
conn.Close(ctx)
51+
controller.Stop()
52+
err := controller.WaitForStop()
53+
require.NoError(t, err)
54+
}()
55+
}
56+
57+
t.Run("show 'port' configuration variable", func(t *testing.T) {
58+
runScript(t, ctx, ScriptTest{
59+
Name: "set 'port' configuration variable",
60+
SetUpScript: []string{},
61+
Assertions: []ScriptTestAssertion{
62+
{
63+
Query: "SHOW port",
64+
Expected: []sql.Row{{port}},
65+
},
66+
{
67+
Query: "SET port TO '5432'",
68+
ExpectedErr: "is a read only variable",
69+
},
70+
{
71+
Query: "SELECT current_setting('port')",
72+
Expected: []sql.Row{{fmt.Sprintf("%v", port)}},
73+
},
74+
},
75+
}, conn, true)
76+
})
77+
}

testing/go/set_test.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package _go
1616

1717
import (
18-
"fmt"
1918
"testing"
2019

2120
"github.com/dolthub/go-mysql-server/sql"
@@ -5836,24 +5835,6 @@ var setStmts = []ScriptTest{
58365835
},
58375836
},
58385837
},
5839-
{
5840-
Name: "set 'port' configuration variable",
5841-
SetUpScript: []string{},
5842-
Assertions: []ScriptTestAssertion{
5843-
{
5844-
Query: "SHOW port",
5845-
Expected: []sql.Row{{currentPort}},
5846-
},
5847-
{
5848-
Query: "SET port TO '5432'",
5849-
ExpectedErr: "is a read only variable",
5850-
},
5851-
{
5852-
Query: "SELECT current_setting('port')",
5853-
Expected: []sql.Row{{fmt.Sprintf("%v", currentPort)}},
5854-
},
5855-
},
5856-
},
58575838
{
58585839
Name: "set 'post_auth_delay' configuration variable",
58595840
SetUpScript: []string{},

0 commit comments

Comments
 (0)