Skip to content

Commit

Permalink
remove rebase's leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
arzonus committed Feb 6, 2025
1 parent 2b79327 commit 5f7e734
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions common/persistence/sql/sqlplugin/sqlite/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,67 +125,3 @@ func Test_buildDSN_attrs(t *testing.T) {
})
}
}

func Test_buildDSN(t *testing.T) {
for name, c := range map[string]struct {
cfg *config.SQL
want string
}{
"empty": {
cfg: &config.SQL{},
want: ":memory:",
},
"database name only": {
cfg: &config.SQL{
DatabaseName: "cadence.db",
},
want: "file:cadence.db",
},
} {
t.Run(name, func(t *testing.T) {
dsn := buildDSN(c.cfg)
assert.Equal(t, c.want, dsn)
})
}
}

func Test_buildDSN_attrs(t *testing.T) {
for name, c := range map[string]struct {
cfg *config.SQL

// wantOneOf contains all possible DSN strings that can be generated because
// the order of the attributes in the DSN string is not guaranteed
wantOneOf []string
}{
"only connection attrs": {
cfg: &config.SQL{
ConnectAttributes: map[string]string{
"_busy_timeout": "10000",
"_FK": "true",
},
},
wantOneOf: []string{
":memory:?_busy_timeout=10000&_fk=true",
":memory:?_fk=true&_busy_timeout=10000",
},
},
"database name and connection attrs": {
cfg: &config.SQL{
DatabaseName: "cadence.db",
ConnectAttributes: map[string]string{
"cache": "PRIVATE",
"cache1 ": "NONe",
},
},
wantOneOf: []string{
"file:cadence.db?cache=private&cache1=none",
"file:cadence.db?cache1=none&cache=private",
},
},
} {
t.Run(name, func(t *testing.T) {
dsn := buildDSN(c.cfg)
assert.Contains(t, c.wantOneOf, dsn)
})
}
}

0 comments on commit 5f7e734

Please sign in to comment.