diff --git a/spec/event_source/protocols/sftp/sftp_message_publish_spec.rb b/spec/event_source/protocols/sftp/sftp_message_publish_spec.rb index 9699a0e6..b6508f4d 100644 --- a/spec/event_source/protocols/sftp/sftp_message_publish_spec.rb +++ b/spec/event_source/protocols/sftp/sftp_message_publish_spec.rb @@ -46,8 +46,27 @@ class SftpProtocolExamplePublishingContext ) end + let(:server_run_path) do + File.expand_path( + File.join( + File.dirname(__FILE__), + "..", + "..", + "..", + ".." + ) + ) + end + before(:each) do FileUtils.rm_f(test_file_upload_path) + @sftp_server_pid = spawn( + "bundle exec ruby spec/mock_services/sftp_server.rb", + { + :chdir => server_run_path + } + ) + sleep(1) EventSource::ConnectionManager.instance.drop_connections_for(:http) EventSource::ConnectionManager.instance.drop_connections_for(:amqp) EventSource::ConnectionManager.instance.drop_connections_for(:sftp) @@ -56,6 +75,10 @@ class SftpProtocolExamplePublishingContext EventSource.config.load_async_api_resources end + after(:each) do + Process.kill("INT", @sftp_server_pid) + end + it "can publish a message" do pub_context = SftpProtocolExamplePublishingContext.new event = pub_context.event( diff --git a/spec/mock_services/sftp_server.rb b/spec/mock_services/sftp_server.rb index 0a3b11d5..6d247938 100644 --- a/spec/mock_services/sftp_server.rb +++ b/spec/mock_services/sftp_server.rb @@ -5,7 +5,7 @@ options = Hash.new logger = Logger.new(STDOUT) -logger.level = Logger::DEBUG +logger.level = Logger::INFO auth_password = HrrRbSsh::Authentication::Authenticator.new { |context| user_and_pass = [