Skip to content

Commit

Permalink
Add a Windows Travis build (#330)
Browse files Browse the repository at this point in the history
* Add a Windows Travis build

* Fix broken test on Windows

* Add test for SQLite finalizer with OS full path
  • Loading branch information
stanislas-m committed Dec 22, 2018
1 parent fafb7e9 commit f47f502
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ matrix:
- dist: trusty
go: "1.11"
env: SODA_DIALECT="sqlite"
- os: windows
go: "1.11"
env: SODA_DIALECT="sqlite"
- dist: trusty
go: "tip"
env: SODA_DIALECT="postgres"
Expand Down
4 changes: 2 additions & 2 deletions dialect_cockroach.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
"sync"

Expand Down Expand Up @@ -266,7 +266,7 @@ func newCockroach(deets *ConnectionDetails) (dialect, error) {
}

func finalizerCockroach(cd *ConnectionDetails) {
appName := path.Base(os.Args[0])
appName := filepath.Base(os.Args[0])
cd.Options["application_name"] = defaults.String(cd.Options["application_name"], appName)
cd.Port = defaults.String(cd.Port, portCockroach)
}
18 changes: 18 additions & 0 deletions dialect_sqlite_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package pop

import (
"io/ioutil"
"os"
"path/filepath"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -89,3 +92,18 @@ func Test_ConnectionDetails_Finalize_SQLite_Synonym_Path(t *testing.T) {
r.Equal("sqlite3", cd.Dialect, "given dialect: sqlite")
r.Equal("./foo.db", cd.Database, "given database: ./foo.db")
}

func Test_ConnectionDetails_FinalizeOSPath(t *testing.T) {
r := require.New(t)
d, err := ioutil.TempDir("", "")
r.NoError(err)
p := filepath.Join(d, "testdb.sqlite")
defer os.RemoveAll(p)
cd := &ConnectionDetails{
Dialect: "sqlite",
Database: p,
}
r.NoError(cd.Finalize())
r.Equal("sqlite3", cd.Dialect)
r.Equal(p, cd.Database)
}

0 comments on commit f47f502

Please sign in to comment.