mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 09:17:05 +02:00
Merge pull request #149 from fluent/fix_unstable_spec_on_circle_ci
Fix unstable spec on circle ci
This commit is contained in:
commit
fea5561c43
@ -17,9 +17,12 @@ module FluentGem
|
|||||||
# but long living caching causes mismatch with actual status e.g. user install plugin from console (without fluentd-ui)
|
# but long living caching causes mismatch with actual status e.g. user install plugin from console (without fluentd-ui)
|
||||||
# So our decision is that cache `gem list` in 3 seconds
|
# So our decision is that cache `gem list` in 3 seconds
|
||||||
Rails.cache.fetch(LIST_CACHE_KEY, expires_in: 3.seconds) do
|
Rails.cache.fetch(LIST_CACHE_KEY, expires_in: 3.seconds) do
|
||||||
output = `#{gem} list`
|
last_status = $?
|
||||||
if $? && $?.exitstatus != 0 # NOTE: $? will be nil on CircleCI, so check $? at first
|
output = `#{gem} list 2>&1`
|
||||||
raise GemError, "failed command: `#{gem} list`"
|
# https://github.com/fluent/fluentd-ui/pull/149#issuecomment-71954588
|
||||||
|
# Sometimes, $? wouldn't override with `#{gem} list` but I don't know why..
|
||||||
|
if $? && last_status != $? && $?.exitstatus != 0 # NOTE: $? will be nil on CircleCI, so check $? at first
|
||||||
|
raise GemError, "failed command: `#{gem} list` output: #{output}"
|
||||||
end
|
end
|
||||||
output.lines.to_a
|
output.lines.to_a
|
||||||
end
|
end
|
||||||
|
@ -21,7 +21,11 @@ module FluentdUI
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.data_dir
|
def self.data_dir
|
||||||
dir = ENV["FLUENTD_UI_DATA_DIR"].presence || ENV["HOME"] + "/.fluentd-ui/core_data"
|
if Rails.env.test?
|
||||||
|
dir = Rails.root.join("tmp", "core_data").to_s
|
||||||
|
else
|
||||||
|
dir = ENV["FLUENTD_UI_DATA_DIR"].presence || ENV["HOME"] + "/.fluentd-ui/core_data"
|
||||||
|
end
|
||||||
FileUtils.mkdir_p(dir) # ensure directory exists
|
FileUtils.mkdir_p(dir) # ensure directory exists
|
||||||
dir
|
dir
|
||||||
end
|
end
|
||||||
|
@ -47,6 +47,8 @@ describe 'Fluentd::Agent::LocalCommon' do
|
|||||||
CONF
|
CONF
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
# other specs could be write in this dir, so clean that in `before`
|
||||||
|
FileUtils.rm_r daemon.agent.config_backup_dir, force: true
|
||||||
::Settings.max_backup_files_count.times do |i|
|
::Settings.max_backup_files_count.times do |i|
|
||||||
backuped_time = now - (i + 1).hours
|
backuped_time = now - (i + 1).hours
|
||||||
FileUtils.touch File.join(daemon.agent.config_backup_dir , "#{backuped_time.strftime('%Y%m%d_%H%M%S')}.conf")
|
FileUtils.touch File.join(daemon.agent.config_backup_dir , "#{backuped_time.strftime('%Y%m%d_%H%M%S')}.conf")
|
||||||
|
@ -61,4 +61,8 @@ RSpec.configure do |config|
|
|||||||
|
|
||||||
# rspec 2.99
|
# rspec 2.99
|
||||||
config.infer_spec_type_from_file_location!
|
config.infer_spec_type_from_file_location!
|
||||||
|
|
||||||
|
config.after(:suite) do
|
||||||
|
FileUtils.rm_rf FluentdUI.data_dir
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user