spec/invoker/config_spec.rb in invoker-1.5.1 vs spec/invoker/config_spec.rb in invoker-1.5.3

- old
+ new

@@ -214,10 +214,51 @@ expect(config.autorunnable_processes.map(&:label)).to eq(['postgres', 'memcached', 'panda-auth']) ensure file.unlink() end end + + it "returns a list of processes that can by index" do + begin + file = Tempfile.new(["config", ".ini"]) + config_data =<<-EOD +[postgres] +command = postgres -D /usr/local/var/postgres +index = 2 +sleep = 5 + +[redis] +command = redis-server /usr/local/etc/redis.conf +disable_autorun = true +index = 3 + +[memcached] +command = /usr/local/opt/memcached/bin/memcached +disable_autorun = false +index = 5 + +[panda-api] +command = bundle exec rails s +disable_autorun = true +index = 4 + +[panda-auth] +command = bundle exec rails s -p $PORT +index = 1 + EOD + file.write(config_data) + file.close + + config = Invoker::Parsers::Config.new(file.path, 9000) + processes = config.autorunnable_processes + expect(processes.map(&:label)).to eq(['panda-auth', 'postgres', 'memcached']) + expect(processes[0].sleep_duration).to eq(1) + expect(processes[1].sleep_duration).to eq(5) + ensure + file.unlink() + end + end end describe "global config file" do it "should use global config file if available" do begin @@ -297,9 +338,13 @@ invoker_ini = create_invoker_ini procfile = create_procfile config = Invoker::Parsers::Config.new(nil, 9000) expect(config.process("some_process").cmd).to eq("some_command") + processes = config.autorunnable_processes + process_1 = processes[0] + expect(process_1.sleep_duration).to eq(1) + expect(process_1.index).to eq(0) ensure File.delete(invoker_ini) File.delete(procfile) end end