Fix test for LogStash::Setting::WritableDirectory#set

path for unix domain socket have a hard limit of 104 on macos and 108 on
linux, using `Stud::Temporary.pathname` to generate the path will exceed
that limit. So we will use a custom generation of using the tmpdir +
Time.now.to_f which should be good enough for this test.

Fixes: #6108

Fixes #6110
This commit is contained in:
Pier-Hugues Pellerin 2016-10-24 10:10:03 -04:00 committed by Suyog Rao
parent 7b811a91e9
commit cbc91f7050

View file

@ -1,12 +1,17 @@
# encoding: utf-8
require "spec_helper"
require "logstash/settings"
require "stud/temporary"
require "tmpdir"
require "socket" # for UNIXSocket
describe LogStash::Setting::WritableDirectory do
let(:mode_rx) { 0555 }
let(:parent) { Stud::Temporary.pathname }
# linux is 108, Macos is 104, so use a safe value
# Stud::Temporary.pathname, will exceed that size without adding anything
let(:parent) { File.join(Dir.tmpdir, Time.now.to_f.to_s) }
let(:path) { File.join(parent, "fancy") }
before { Dir.mkdir(parent) }