livehelpnow / tds_ecto

TDS Adapter for Ecto
57 stars 34 forks source link

Attempt to run tests fails #31

Closed tahbaza closed 8 years ago

tahbaza commented 8 years ago

Attempts to execute mix test fails with the following details. `$ mix test \ (EXIT from #PID<0.46.0>) %Tds.Error{message: "tcp connect: timeout", mssql: nil}

17:20:54.862 [error] GenServer #PID<0.186.0> terminating \ (stop) %Tds.Error{message: "tcp connect: timeout", mssql: nil}`

mssql.local has been created as an alias that points to a local SQL Server 2014 instance and I've validated successful connection with that alias using SQL Server Management Studio using the mssql/mssql account in the test configuration. The SQL Server Browser is verified running.

However, I'm able to connect successfully to the same instance using the Tds library alone like so...

{:ok, pid} = Tds.Connection.start_link([hostname: "localhost", instance: "S2014", username: "mssql", password: "mssql", database: "master"])
Tds.Connection.query(pid, "SELECT [Name] FROM cfree.dbo.distributor;", [])

Is it simply a requirement to have a "default" SQL Server instance installed and available for use in running the tests?

tahbaza commented 8 years ago

Modifying the connection parameters to include the specific port allocated to the instance in order to override the assumed, default 1433 resolved the issue for me:

{:ok, pid} = Tds.Ecto.Connection.connect([hostname: "mssql.local", username: "mssql", password: "mssql", database: "master", port: 16898])