Skip to main content
  1. Posts/

Day 61 - Tribulations

OldDays seitan-spin ruby

In which we struggle with SQL Server (again) and Jekyll (again).

tcp:127.0.0.1,23999
#

Learning the lesson again: try out things on the laptop from time to time to make sure it still works away from my main development machine.

I got to the library, got on their wi-fi network, tried to run the tests, and promptly got errors on everything (both sqlcmd and TinyTDS). Eventually I found that I needed to try harder to force TCP connections, and that I had to direct it toward the magic port I had set up (and forgotten about):

Listen on all interfaces, good.
Listen on all interfaces, good.
Listen on that special port.
Listen on that special port.

I can set the DB_DATASERVER to explicitly hit that TCP port:

set DB_DATASERVER=tcp:localhost,23999

and that takes care of the calls to sqlcmd. But TinyTDS won’t take that string format, so I introduced a DB_HOST_OVERRIDE and DB_PORT_OVERRIDE in the environment:

set DB_HOST_OVERRIDE=localhost
set DB_PORT_OVERRIDE=23999

and abstracted out the hash we’re passing to the connect method:

features/lib/db_helper.rb
 8
 9
10
11
12
13
14
15
16
17
18
def db_connect_hash(server_database)
  connect_hash = {username: ENV['DB_USERNAME'], password: ENV['DB_PASSWORD'], 
    dataserver: ENV['DB_DATASERVER'], database: server_database}
  if ENV['DB_HOST_OVERRIDE']
    connect_hash[:host] = ENV['DB_HOST_OVERRIDE']
    connect_hash[:port] = ENV['DB_PORT_OVERRIDE']
    connect_hash.delete(:dataserver)
  end
  puts "Will connect to DB using #{connect_hash}"
  connect_hash
end

And then finally everything works again.

Blog conversion false start
#

I’m desperate to ditch Octopress and get back to reasonable site rendering times, so I’ve been looking for a good minimal theme for straight Jekyll. I thought I had found a good prospect in the Lambda theme, so I started by converting “Day 1” over to it. All went well until there was a code block with line numbers.

So I’m off to look for another theme, this time checking how numbered syntax highlighting looks in the demo page.

And a couple of tests
#

Just to keep today from being a complete loss, I added the rest of the combinations of ClearStores and RestockStores. In the case where one is false, we’re waiting for it to show in the log and expecting a timeout:

features/steps/vendor_steps.rb
32
33
34
Then(/^the log does not show any items restocked in stores$/) do
  expect { log_contains('Restocked % store records.') }.to raise_error(Timeout::Error)
end

which is really needlessly slow and prone to errors (what if it just takes longer than the timeout to get to the point of restocking the stores?). So we’ll want to fix that. Tomorrow.


Useful Stuff
#


More to come
More to come

Day 61 code - tests