Skip to content

Commit 20758d4

Browse files
committed
(MODULES-8748) Add OSX testing
Previously Travis CI only tested linux. This commit adds a single cell of OSX testing to ensure that the PowerShell manager can communicate correctly with a PowerShell Core Pipe Server. This is required due to Unix Domain Sockets behaving differently on OSX as compared to Linux (Ubuntu Trusty).
1 parent dec8250 commit 20758d4

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

.travis.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
---
2+
os:
3+
- linux
4+
# OSX Only tests on the latest Puppet Gem, not the full matrix as there's no need to double up
5+
# testing effort here. We are only concerned about whether the Mac OSX edition of PowerShell Core
6+
# will work with our PowerShell manager code.
7+
- osx
8+
29
dist: trusty
310
language: ruby
411
cache: bundler
512
before_install:
613
# Additional instructions
7-
- curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
8-
- curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
9-
- sudo apt-get update
10-
- sudo apt-get install -y powershell
14+
# Install PowerShell Core for Ubuntu 14.04
15+
# There's an intermittent minor issue with the public key so just reset it with apt-key ... - https://github.com/git-lfs/git-lfs/issues/3474
16+
- if [ $TRAVIS_OS_NAME == "linux" ]; then
17+
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -;
18+
curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list;
19+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B05F25D762E3157;
20+
sudo apt-get update;
21+
sudo apt-get install -y powershell;
22+
fi
23+
# Install PowerShell Core for Mac
24+
- if [ $TRAVIS_OS_NAME == "osx" ]; then
25+
brew cask install powershell;
26+
fi
27+
# Output the PowerShell Core version information
28+
- pwsh -NoProfile -NoLogo -NonInteractive -Command \$PSVersionTable
1129
- if [ $BUNDLER_VERSION ]; then
1230
gem install -v $BUNDLER_VERSION bundler --no-rdoc --no-ri;
1331
fi
@@ -24,18 +42,17 @@ rvm:
2442
env:
2543
global:
2644
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
45+
- CHECK=parallel_spec
2746
matrix:
2847
fast_finish: true
2948
include:
3049
-
3150
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
3251
-
33-
env: CHECK=parallel_spec
34-
-
35-
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
52+
env: PUPPET_GEM_VERSION="~> 5.0"
3653
rvm: 2.4.4
3754
-
38-
env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec RUBYGEMS_VERSION=2.7.8 BUNDLER_VERSION=1.17.3
55+
env: PUPPET_GEM_VERSION="~> 4.0" RUBYGEMS_VERSION=2.7.8 BUNDLER_VERSION=1.17.3
3956
rvm: 2.1.9
4057
branches:
4158
only:

spec/integration/puppet_x/puppetlabs/powershell_manager_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def line_end
4242
Puppet::Util::Platform.windows? ? "\r\n" : "\n"
4343
end
4444

45+
def is_osx?
46+
# Note this test fails if running in JRuby, but because the unit tests are MRI only, this is ok
47+
!RUBY_PLATFORM.match(/darwin/).nil?
48+
end
49+
4550
let (:manager) { create_manager(ps_command, ps_args) }
4651

4752
describe "when managing the powershell process" do
@@ -325,6 +330,9 @@ def close_stream(stream, style = :inprocess)
325330
expect(result[:stdout]).to eq(nil)
326331
if Puppet::Util::Platform.windows?
327332
expect(result[:stderr]).to eq(["'foo.exe' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"])
333+
elsif is_osx?
334+
expect(result[:stderr][0]).to match(/foo\.exe: command not found/)
335+
expect(result[:stderr][0]).to match(/bar/)
328336
else
329337
expect(result[:stderr][0]).to match(/foo\.exe: not found/)
330338
expect(result[:stderr][0]).to match(/bar/)

0 commit comments

Comments
 (0)