add circus support
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
require "spec_helper"
|
||||
require "foreman/engine"
|
||||
require "foreman/export/circus"
|
||||
require "tmpdir"
|
||||
|
||||
describe Foreman::Export::Circus, :fakefs do
|
||||
let(:procfile) { FileUtils.mkdir_p("/tmp/app"); write_procfile("/tmp/app/Procfile") }
|
||||
let(:formation) { nil }
|
||||
let(:engine) { Foreman::Engine.new(:formation => formation).load_procfile(procfile) }
|
||||
let(:options) { Hash.new }
|
||||
let(:circus) { Foreman::Export::Circus.new("/tmp/init", engine, options) }
|
||||
|
||||
before(:each) { load_export_templates_into_fakefs("circus") }
|
||||
before(:each) { stub(circus).say }
|
||||
|
||||
it "exports to the filesystem" do
|
||||
circus.export
|
||||
File.read("/tmp/init/app.ini").should == example_export_file("circus/app-alpha-1.ini")
|
||||
end
|
||||
|
||||
it "cleans up if exporting into an existing dir" do
|
||||
mock(FileUtils).rm("/tmp/init/app.ini")
|
||||
circus.export
|
||||
circus.export
|
||||
end
|
||||
|
||||
context "with concurrency" do
|
||||
let(:formation) { "alpha=2" }
|
||||
|
||||
it "exports to the filesystem with concurrency" do
|
||||
circus.export
|
||||
File.read("/tmp/init/app.ini").should == example_export_file("circus/app-alpha-2.ini")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
[circus]
|
||||
check_delay = 5
|
||||
endpoint = tcp://127.0.0.1:5555
|
||||
|
||||
[watcher:app-alpha-1]
|
||||
cmd = ./alpha
|
||||
working_dir = /tmp/app
|
||||
uid = app
|
||||
stdout_stream.class = FileStream
|
||||
stdout_stream.filename = /var/log/app/alpha-1.log
|
||||
stderr_stream.class = FileStream
|
||||
stderr_stream.filename = /var/log/app/alpha-1.error.log
|
||||
copy_env = True
|
||||
|
||||
[env:app-alpha-1]
|
||||
PORT = 5000
|
||||
|
||||
[watcher:app-bravo-1]
|
||||
cmd = ./bravo
|
||||
working_dir = /tmp/app
|
||||
uid = app
|
||||
stdout_stream.class = FileStream
|
||||
stdout_stream.filename = /var/log/app/bravo-1.log
|
||||
stderr_stream.class = FileStream
|
||||
stderr_stream.filename = /var/log/app/bravo-1.error.log
|
||||
copy_env = True
|
||||
|
||||
[env:app-bravo-1]
|
||||
PORT = 5100
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
[circus]
|
||||
check_delay = 5
|
||||
endpoint = tcp://127.0.0.1:5555
|
||||
|
||||
[watcher:app-alpha-1]
|
||||
cmd = ./alpha
|
||||
working_dir = /tmp/app
|
||||
uid = app
|
||||
stdout_stream.class = FileStream
|
||||
stdout_stream.filename = /var/log/app/alpha-1.log
|
||||
stderr_stream.class = FileStream
|
||||
stderr_stream.filename = /var/log/app/alpha-1.error.log
|
||||
copy_env = True
|
||||
|
||||
[env:app-alpha-1]
|
||||
PORT = 5000
|
||||
|
||||
[watcher:app-alpha-2]
|
||||
cmd = ./alpha
|
||||
working_dir = /tmp/app
|
||||
uid = app
|
||||
stdout_stream.class = FileStream
|
||||
stdout_stream.filename = /var/log/app/alpha-2.log
|
||||
stderr_stream.class = FileStream
|
||||
stderr_stream.filename = /var/log/app/alpha-2.error.log
|
||||
copy_env = True
|
||||
|
||||
[env:app-alpha-2]
|
||||
PORT = 5001
|
||||
|
||||
Reference in New Issue
Block a user