Skip to content

Commit 0b952e5

Browse files
committed
amend bats and workbench mysql-client integrations
1 parent c6e1eb3 commit 0b952e5

10 files changed

Lines changed: 37 additions & 35 deletions

File tree

go/cmd/dolt/commands/commit.go

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -239,20 +239,15 @@ func constructParametrizedDoltCommitQuery(msg string, apr *argparser.ArgParseRes
239239
writeToBuffer("-f")
240240
}
241241

242-
writeToBuffer("--author")
243-
param = true
244-
writeToBuffer("?")
245-
var author string
246242
if apr.Contains(cli.AuthorParam) {
247-
author, _ = apr.GetValue(cli.AuthorParam)
248-
} else {
249-
name, email, err := env.GetNameAndEmail(cliCtx.Config())
250-
if err != nil {
251-
return "", nil, err
252-
}
253-
author = name + " <" + email + ">"
243+
writeToBuffer("--author")
244+
param = true
245+
writeToBuffer("?")
246+
author, _ := apr.GetValue(cli.AuthorParam)
247+
params = append(params, author)
248+
} else if _, _, err := env.GetNameAndEmail(cliCtx.Config()); err != nil {
249+
return "", nil, err
254250
}
255-
params = append(params, author)
256251

257252
if apr.Contains(cli.AllFlag) {
258253
writeToBuffer("-a")

integration-tests/bats/config.bats

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,14 @@ function no_stdout {
233233
[[ $output = "" ]] || false
234234

235235
dolt add .
236-
run dolt commit --author="John Doe <john@doe.com>" -m="Commit1"
237-
[ "$status" -ne 0 ]
238-
[[ "$output" =~ "Could not determine user.name" ]] || false
239-
240-
dolt config --global --add user.name "bats tester"
241-
dolt config --global --add user.email "joshn@doe.com"
242-
243236
run dolt commit --author="John Doe <john@doe.com>" -m="Commit1"
244237
[ "$status" -eq 0 ]
245238
[[ "$output" =~ "John Doe <john@doe.com>" ]] || false
239+
240+
run dolt log
241+
[ "$status" -eq 0 ]
242+
regex='John Doe <john@doe.com>'
243+
[[ "$output" =~ "$regex" ]] || false
246244
}
247245

248246
@test "config: SQL can create databases with no user and email set" {

integration-tests/bats/sql-commit.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,10 @@ SQL
312312
dolt add test_committer4
313313
TZ=PST+8 DOLT_COMMITTER_NAME="Date Committer" DOLT_COMMITTER_EMAIL="date@committer.com" DOLT_COMMITTER_DATE='2023-09-26T12:34:56' DOLT_AUTHOR_DATE='2023-09-26T01:23:45' DOLT_AUTHOR_NAME='Date Author' dolt commit -m "Commit with different committer timestamp"
314314

315-
run dolt sql -r csv -q "SELECT committer, email, date FROM dolt_commits WHERE message = 'Commit with different committer timestamp'"
315+
run dolt sql -r csv -q "SELECT author, author_email, committer, email, date FROM dolt_commits WHERE message = 'Commit with different committer timestamp'"
316316
[ "$status" -eq 0 ]
317317
[[ "$output" =~ committer,email,date ]] || false
318-
[[ "$output" =~ "Date Committer,date@committer.com,2023-09-26 12:34:56" ]] || false
318+
[[ "$output" =~ "Date Author,bats@email.fake,Date Committer,date@committer.com,2023-09-26 12:34:56" ]] || false
319319

320320
run dolt sql -r csv -q "SELECT author, author_date, committer, date FROM dolt_log WHERE message = 'Commit with different committer timestamp'"
321321
[ "$status" -eq 0 ]

integration-tests/bats/sql-server.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ EOF
7070
dolt -u user1 sql -q "call dolt_commit('--author', 'barbie <barbie@plastic.com>', '-Am', 'committing as barbie');"
7171
run dolt -u user1 sql -q "select author, author_email, message, committer, email from dolt_log limit 1;" -r csv
7272
[ "$status" -eq 0 ]
73-
[[ $output =~ "barbie,barbie@plastic.com,committing as barbie,Bats Tests,bats@email.fake" ]] || false
73+
[[ $output =~ "barbie,barbie@plastic.com,committing as barbie,barbie,barbie@plastic.com" ]] || false
7474
}
7575

7676
@test "sql-server: can create savepoint when no database is selected" {

integration-tests/compatibility/test_files/bats/bidirectional/server_cli_compat.bats renamed to integration-tests/compatibility/test_files/bats/server_cli_compat.bats

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#!/usr/bin/env bats
22
#
3-
# Verifies the SQL server and CLI client work across Dolt versions. DOLT_OLD_BIN and
4-
# DOLT_NEW_BIN are slot labels assigned by runner.sh; the bidirectional phase swaps them
5-
# between sub-runs, so neither name claims age. Tests reach the binaries via old_dolt and
6-
# new_dolt; new_dolt_cli targets the running sql-server. REPO_DIR is the pre-populated
7-
# repo from setup_repo.sh.
3+
# Verifies the SQL server and CLI client work across Dolt versions. DOLT_OLD_BIN runs
4+
# the sql-server, DOLT_NEW_BIN runs the client; both default to dolt on PATH. Tests
5+
# reach the binaries via old_dolt and new_dolt; new_dolt_cli targets the running
6+
# sql-server. REPO_DIR is the pre-populated repo from setup_repo.sh.
7+
#
8+
# This file lives at the test_files/bats/ root rather than bidirectional/ because it
9+
# requires REPO_DIR to be populated by setup_repo.sh, while the bidirectional sub-phase
10+
# hands tests an empty REPO_DIR for self-init coverage.
811

912
setup_file() {
1013
export BATS_TEST_RETRIES=3

integration-tests/go-sql-server-driver/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ require (
1717
github.com/creasty/defaults v1.6.0 // indirect
1818
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
1919
github.com/google/go-cmp v0.7.0 // indirect
20+
github.com/pkg/errors v0.9.1 // indirect
2021
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
2122
golang.org/x/crypto v0.48.0 // indirect
2223
golang.org/x/sys v0.41.0 // indirect
24+
gopkg.in/src-d/go-errors.v1 v1.0.0 // indirect
2325
)
2426

2527
replace github.com/dolthub/dolt/go => ../../go/

integration-tests/go-sql-server-driver/go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
1212
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
1313
github.com/klauspost/cpuid/v2 v2.0.12 h1:p9dKCg8i4gmOxtv35DvrYoWqYzQrvEVdjQ762Y0OqZE=
1414
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
15+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
16+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
1517
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
1618
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1719
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
@@ -30,5 +32,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+
3032
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3133
gopkg.in/go-jose/go-jose.v2 v2.6.3 h1:nt80fvSDlhKWQgSWyHyy5CfmlQr+asih51R8PTWNKKs=
3234
gopkg.in/go-jose/go-jose.v2 v2.6.3/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI=
35+
gopkg.in/src-d/go-errors.v1 v1.0.0 h1:cooGdZnCjYbeS1zb1s6pVAAimTdKceRrpn7aKOnNIfc=
36+
gopkg.in/src-d/go-errors.v1 v1.0.0/go.mod h1:q1cBlomlw2FnDBDNGlnh6X0jPihy+QxZfMMNxPCbdYg=
3337
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
3438
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

integration-tests/mysql-client-tests/node/workbenchTests/branches.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export const branchTests = [
6363
{
6464
name: "mybranch",
6565
hash: "",
66-
latest_committer: "dolt",
67-
latest_committer_email: "dolt@%",
66+
latest_committer: "Dolt",
67+
latest_committer_email: "dolt@dolthub.com",
6868
latest_commit_date: "",
6969
latest_commit_message: "Create table test",
7070
remote: "",

integration-tests/mysql-client-tests/node/workbenchTests/logs.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export const logTests = [
2626
res: [
2727
{
2828
commit_hash: "",
29-
committer: "dolt",
30-
email: "dolt@%",
29+
committer: "Dolt",
30+
email: "dolt@dolthub.com",
3131
date: "",
3232
message: "Create table test",
3333
commit_order: 2,
@@ -55,8 +55,8 @@ export const logTests = [
5555
res: [
5656
{
5757
commit_hash: "",
58-
committer: "dolt",
59-
email: "dolt@%",
58+
committer: "Dolt",
59+
email: "dolt@dolthub.com",
6060
date: "",
6161
message: "Create table test",
6262
commit_order: 2,

integration-tests/mysql-client-tests/node/workbenchTests/merge.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ export const mergeTests = [
3636
{
3737
commit_hash: "",
3838
message: "Create table test",
39-
committer: "dolt",
40-
email: "dolt@%",
39+
committer: "Dolt",
40+
email: "dolt@dolthub.com",
4141
date: "",
4242
commit_order: 2,
4343
author: "Dolt",

0 commit comments

Comments
 (0)