Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-03 14:39:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-03 14:39:58 +0300
commita0184c59f6b932034834b7b469eaf45fd121ce82 (patch)
treeebc7ec1b4424392e484f67c47f120af7f61d1dcc /spec/models
parent468b5ccaf7a622e55549599ceb5b18220b5bf0aa (diff)
Add latest changes from gitlab-org/security/gitlab@14-7-stable-ee
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/integrations/irker_spec.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/spec/models/integrations/irker_spec.rb b/spec/models/integrations/irker_spec.rb
index 8b207e8b43e..8aea2c26dc5 100644
--- a/spec/models/integrations/irker_spec.rb
+++ b/spec/models/integrations/irker_spec.rb
@@ -2,6 +2,7 @@
require 'spec_helper'
require 'socket'
+require 'timeout'
require 'json'
RSpec.describe Integrations::Irker do
@@ -37,6 +38,7 @@ RSpec.describe Integrations::Irker do
before do
@irker_server = TCPServer.new 'localhost', 0
+ allow(Gitlab::CurrentSettings).to receive(:allow_local_requests_from_web_hooks_and_services?).and_return(true)
allow(irker).to receive_messages(
active: true,
project: project,
@@ -58,13 +60,17 @@ RSpec.describe Integrations::Irker do
irker.execute(sample_data)
conn = @irker_server.accept
- conn.each_line do |line|
- msg = Gitlab::Json.parse(line.chomp("\n"))
- expect(msg.keys).to match_array(%w(to privmsg))
- expect(msg['to']).to match_array(["irc://chat.freenode.net/#commits",
- "irc://test.net/#test"])
+
+ Timeout.timeout(5) do
+ conn.each_line do |line|
+ msg = Gitlab::Json.parse(line.chomp("\n"))
+ expect(msg.keys).to match_array(%w(to privmsg))
+ expect(msg['to']).to match_array(["irc://chat.freenode.net/#commits",
+ "irc://test.net/#test"])
+ end
end
- conn.close
+ ensure
+ conn.close if conn
end
end
end