Skip to content

Commit

Permalink
fix(freebsd): ensure git is installed and default tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
myii committed Apr 1, 2021
1 parent 1a22291 commit f6f009b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions golang/cmd/goget.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import golang with context %}
{%- if grains.os_family == "FreeBSD" %}
golang-cmd-goget-pkg-installed-git:
pkg.installed:
- name: git
{%- endif %}
{%- for package in golang.cmd.goget %}
golang-cmd-goget-cmd-run-go-get-{{ package }}:
cmd.run:
- name: go get {{ package }}
- runas: {{ golang.rootuser }}
- onlyif: which go || test -f /usr/local/bin/go
{%- if grains.os_family == "FreeBSD" %}
- require:
- pkg: golang-cmd-goget-pkg-installed-git
{%- endif %}
{%- endfor %}
12 changes: 10 additions & 2 deletions test/integration/default/controls/archives_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# frozen_string_literal: true

dir_go, dir_go_group =
case system.platform[:family]
when 'bsd'
%w[/usr/local/go1.14.2.freebsd-amd64/go wheel]
else
%w[/usr/local/go1.14.2.linux-amd64/go root]
end

control 'golang tar archive' do
impact 1.0
title 'should be installed'
desc 'Ensure golang tarball archive was extracted correctly'

describe file('/usr/local/go1.14.2.linux-amd64/go') do
describe file(dir_go) do
it { should be_directory }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_grouped_into dir_go_group }
its('mode') { should cmp '0755' }
end
end

0 comments on commit f6f009b

Please sign in to comment.