From fd68f3c12c10d74be9eae67929f720b250b26187 Mon Sep 17 00:00:00 2001 From: Ben Ford Date: Mon, 8 Jul 2019 10:53:23 -0700 Subject: [PATCH] Windows can't handle the : character in a filename. This renames the file and then makes a symlink to the original filename when the specs are run. This will allow the module to be installed without errors onto a windows machine. The other alternatives I considered were things like mocking File.read to magically translate invalid characters, but that seemed like more wtf than this. Happy to consider other approaches though! Fixes #224 --- .gitignore | 4 ++++ Rakefile | 10 ++++++++++ .../redhat_spec/network-scripts/ifcfg-eth0:10000000 | 9 --------- .../redhat_spec/network-scripts/ifcfg-eth0_10000000 | 1 + 4 files changed, 15 insertions(+), 9 deletions(-) delete mode 100644 spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0:10000000 create mode 120000 spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0_10000000 diff --git a/.gitignore b/.gitignore index e9b3cf4b..b1787c53 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,7 @@ Puppetfile.lock .*.sw? .yardoc/ Guardfile + +# This filename makes windows barf. Which breaks deploys +spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0:10000000 + diff --git a/Rakefile b/Rakefile index 09701d0f..8da0f19a 100644 --- a/Rakefile +++ b/Rakefile @@ -24,6 +24,16 @@ task 'lint:auto_correct' do Rake::Task[:lint_fix].invoke end +# So windows cannot handle paths with a : character. But that's used by +# a network config fixture. The simplest way to handle it without weird +# and confusing File.read mocks is to simply symlink it before tests are +# run. Gross? Yeah, but it seems like the least gross option. +task :fix_pathname do + FileUtils.ln_sf 'spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0_10000000', + 'spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0:10000000' +end +task :spec_prep => :fix_pathname + desc 'Run acceptance tests' RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' diff --git a/spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0:10000000 b/spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0:10000000 deleted file mode 100644 index e9a9f338..00000000 --- a/spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0:10000000 +++ /dev/null @@ -1,9 +0,0 @@ -DEVICE="eth0:10000000" -IPADDR="10.10.10.10" -NETMASK="255.255.255.0" -BOOTPROTO="none" -IPV6INIT="no" -MTU="9000" -NM_CONTROLLED="no" -ONBOOT="yes" -TYPE="Ethernet" diff --git a/spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0_10000000 b/spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0_10000000 new file mode 120000 index 00000000..adc3dcee --- /dev/null +++ b/spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0_10000000 @@ -0,0 +1 @@ +spec/fixtures/provider/network_config/redhat_spec/network-scripts/ifcfg-eth0_10000000 \ No newline at end of file