From efc04d68fc709f997439c5ebedb8a72773f1d693 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Fri, 13 Sep 2024 14:24:44 -0700 Subject: [PATCH] Play nice with the matrix-based Actions workflow running the tests --- script/test-redirections | 2 +- spec/github_pages_health_check/domain_spec.rb | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/script/test-redirections b/script/test-redirections index 23a84d8..4bfc358 100755 --- a/script/test-redirections +++ b/script/test-redirections @@ -11,7 +11,7 @@ def start_server(port, location) client = server.accept # Append a hit in the file - File.open('/tmp/bad-redirection.log', 'a') do |file| + File.open("/tmp/bad-redirection#{ENV["RUBY_VERSION"]}.log", 'a') do |file| file.print("HIT #{port} ") end diff --git a/spec/github_pages_health_check/domain_spec.rb b/spec/github_pages_health_check/domain_spec.rb index 74cbed8..50cb87a 100644 --- a/spec/github_pages_health_check/domain_spec.rb +++ b/spec/github_pages_health_check/domain_spec.rb @@ -664,11 +664,13 @@ end context "Protocol redirections" do - let(:log_file) { "/tmp/bad-redirection.log" } + let(:log_file) { "/tmp/bad-redirection#{ENV["RUBY_VERSION"]}.log" } + before do + File.open(log_file, "w") # truncate log file + end it "it follows ftp if requested" do # Make a real request to a local server started with /script/test-redirections - File.open(log_file, "w") # truncate log file Typhoeus.get( "http://localhost:9988", GitHubPages::HealthCheck.typhoeus_options.merge(:redir_protocols => %i[http https ftp]) @@ -680,7 +682,6 @@ it "it does not follow anything other than http/https by default" do # Make a real request to a local server started with /script/test-redirections - File.open(log_file, "w") # truncate log file Typhoeus.get( "http://localhost:9988", GitHubPages::HealthCheck.typhoeus_options