Skip to content

Commit

Permalink
ddollarGH-268 Extended spec testing runit export to include additiona…
Browse files Browse the repository at this point in the history
…l port
  • Loading branch information
padcom committed Sep 26, 2012
1 parent 3571265 commit fc2bad5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions spec/foreman/export/runit_spec.rb
Expand Up @@ -4,7 +4,7 @@
require "tmpdir"

describe Foreman::Export::Runit, :fakefs do
let(:procfile) { FileUtils.mkdir_p("/tmp/app"); write_procfile("/tmp/app/Procfile", 'bar=baz') }
let(:procfile) { FileUtils.mkdir_p("/tmp/app"); write_procfile("/tmp/app/Procfile", 'bar=baz PORT2=$PORT2') }
let(:engine) { Foreman::Engine.new(:formation => "alpha=2,bravo=1").load_procfile(procfile) }
let(:options) { Hash.new }
let(:runit) { Foreman::Export::Runit.new('/tmp/init', engine, options) }
Expand All @@ -20,14 +20,16 @@
File.read("/tmp/init/app-alpha-1/run").should == example_export_file('runit/app-alpha-1/run')
File.read("/tmp/init/app-alpha-1/log/run").should == example_export_file('runit/app-alpha-1/log/run')
File.read("/tmp/init/app-alpha-1/env/PORT").should == "5000\n"
File.read("/tmp/init/app-alpha-1/env/PORT2").should == "5100\n"
File.read("/tmp/init/app-alpha-1/env/BAR").should == "baz\n"
File.read("/tmp/init/app-alpha-2/run").should == example_export_file('runit/app-alpha-2/run')
File.read("/tmp/init/app-alpha-2/log/run").should == example_export_file('runit/app-alpha-2/log/run')
File.read("/tmp/init/app-alpha-2/env/PORT").should == "5001\n"
File.read("/tmp/init/app-alpha-2/env/PORT2").should == "5101\n"
File.read("/tmp/init/app-alpha-2/env/BAR").should == "baz\n"
File.read("/tmp/init/app-bravo-1/run").should == example_export_file('runit/app-bravo-1/run')
File.read("/tmp/init/app-bravo-1/log/run").should == example_export_file('runit/app-bravo-1/log/run')
File.read("/tmp/init/app-bravo-1/env/PORT").should == "5100\n"
File.read("/tmp/init/app-bravo-1/env/PORT").should == "5200\n"
end

it "creates a full path to the export directory" do
Expand Down
2 changes: 1 addition & 1 deletion spec/resources/export/runit/app-alpha-1/run
@@ -1,3 +1,3 @@
#!/bin/sh
cd /tmp/app
exec chpst -u app -e /tmp/init/app-alpha-1/env ./alpha bar=baz
exec chpst -u app -e /tmp/init/app-alpha-1/env ./alpha bar=baz PORT2=$PORT2
2 changes: 1 addition & 1 deletion spec/resources/export/runit/app-alpha-2/run
@@ -1,3 +1,3 @@
#!/bin/sh
cd /tmp/app
exec chpst -u app -e /tmp/init/app-alpha-2/env ./alpha bar=baz
exec chpst -u app -e /tmp/init/app-alpha-2/env ./alpha bar=baz PORT2=$PORT2

0 comments on commit fc2bad5

Please sign in to comment.