Skip to content

Commit

Permalink
Fix test suite and some other adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
TuningYourCode committed Dec 4, 2020
1 parent 7b75e22 commit dcfa583
Show file tree
Hide file tree
Showing 22 changed files with 358 additions and 245 deletions.
2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fixtures:
forge_modules:
stdlib: 'puppetlabs/stdlib'
wget: 'maestrodev/wget'
wget: 'puppet/wget'
symlinks:
nexus: "#{source_dir}"
22 changes: 22 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build and publish to Puppet Forge

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get latest tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Clone repository
uses: actions/checkout@v1
with:
ref: ${{ env.RELEASE_VERSION }}
- name: Build and publish module
uses: barnumbirr/[email protected]
env:
FORGE_API_KEY: ${{ secrets.FORGE_API_KEY }}
REPOSITORY_URL: https://forgeapi.puppet.com/v3/releases
21 changes: 21 additions & 0 deletions .github/workflows/run-static-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Run static validation

on:
- push
- pull_request

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Run static validation on puppet 5
uses: puppets-epic-show-theatre/action-pdk-validate@v1
with:
puppet-version: "5"

- name: Run static validation on puppet 6
uses: puppets-epic-show-theatre/action-pdk-validate@v1
with:
puppet-version: "6"
21 changes: 21 additions & 0 deletions .github/workflows/run-unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Run unit tests

on:
- push
- pull_request

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Run unit tests on puppet 5
uses: puppets-epic-show-theatre/action-pdk-test-unit@v1
with:
puppet-version: "5"

- name: Run unit tests on puppet 6
uses: puppets-epic-show-theatre/action-pdk-test-unit@v1
with:
puppet-version: "6"
3 changes: 2 additions & 1 deletion .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/.bundle/
/.idea/
/.vagrant/
/Vagrantfile
/coverage/
/bin/
/doc/
Expand Down Expand Up @@ -41,3 +40,5 @@
/.yardopts
/spec/
/.vscode/
/.github/
Vagrantfile
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ Style/BlockDelimiters:
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
be consistent then.
EnforcedStyle: braces_for_chaining
Style/BracesAroundHashParameters:
Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0.
See https://github.com/rubocop-hq/rubocop/pull/7643
Enabled: true
Style/ClassAndModuleChildren:
Description: Compact style reduces the required amount of indentation.
EnforcedStyle: compact
Expand Down
12 changes: 12 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
disable_legacy_facts: false
appveyor.yml:
delete: true
.gitlab-ci.yml:
delete: true
.travis.yml:
delete: true
.pdkignore:
paths:
- /.github/
- Vagrantfile
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"recommendations": [
"jpogran.puppet-vscode",
"puppet.puppet-vscode",
"rebornix.Ruby"
]
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file.

## 1.7.5

* Extended test suite to puppet 5 and puppet 6
* Fix test suite
* Updated README.md and metadata.json
* Added .sync.yml for `pdk update`

## 1.7.4

* Replaced obsolete `maestrodev/wget` module by [puppet/wget](https://github.com/voxpupuli/puppet-wget)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)

Copyright (c) 2013 HubSpot, Inc.
Copyright (c) 2020 Puppet Enterprise Support Team
Copyright (c) 2020 Puppets Epic Show Theatre

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 6 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,36 +52,35 @@ if Bundler.rubygems.find_name('github_changelog_generator').any?
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)."
config.add_pr_wo_labels = true
config.issues = false
config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM"
config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB"
config.configure_sections = {
"Changed" => {
"prefix" => "### Changed",
"labels" => ["backwards-incompatible"],
},
"Added" => {
"prefix" => "### Added",
"labels" => ["feature", "enhancement"],
"labels" => ["enhancement", "feature"],
},
"Fixed" => {
"prefix" => "### Fixed",
"labels" => ["bugfix"],
"labels" => ["bug", "documentation", "bugfix"],
},
}
end
else
desc 'Generate a Changelog from GitHub'
task :changelog do
raise <<EOM
The changelog tasks depends on unreleased features of the github_changelog_generator gem.
The changelog tasks depends on recent features of the github_changelog_generator gem.
Please manually add it to your .sync.yml for now, and run `pdk update`:
---
Gemfile:
optional:
':development':
- gem: 'github_changelog_generator'
git: 'https://github.com/skywinder/github-changelog-generator'
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
version: '~> 1.15'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')"
EOM
end
end
Expand Down
21 changes: 8 additions & 13 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "pest-nexus",
"version": "1.7.4",
"author": "Tom McLaughlin <[email protected]>, Puppet Enterprise Support Team",
"version": "1.7.5",
"author": "Puppets Epic Show Theatre",
"summary": "Puppet module for Sonatype Nexus",
"license": "MIT",
"source": "https://github.com/puppet-enterprise-support-team/puppet-nexus",
"project_page": "https://github.com/puppet-enterprise-support-team/puppet-nexus",
"issues_url": "https://github.com/puppet-enterprise-support-team/puppet-nexus/issues",
"source": "https://github.com/puppets-epic-show-theatre/puppet-nexus",
"project_page": "https://github.com/puppets-epic-show-theatre/puppet-nexus",
"issues_url": "https://github.com/puppets-epic-show-theatre/puppet-nexus/issues",
"dependencies": [
{
"name": "puppetlabs/stdlib",
Expand All @@ -21,16 +21,12 @@
{
"operatingsystem": "Centos",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
Expand All @@ -44,7 +40,6 @@
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"8",
"9",
"10"
]
Expand All @@ -56,7 +51,7 @@
"version_requirement": ">= 4.10.0 < 7.0.0"
}
],
"pdk-version": "1.16.0",
"template-url": "pdk-default#1.16.0",
"template-ref": "tags/1.16.0-0-gaf44904"
"pdk-version": "1.18.1",
"template-url": "pdk-default#1.18.1",
"template-ref": "tags/1.18.1-0-g3d2e75c"
}
14 changes: 6 additions & 8 deletions spec/acceptance/checksum_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
require 'spec_helper_acceptance'

describe 'apt class' do

context 'default parameters' do
# Using puppet_apply as a helper
it 'should work with no errors' do
it 'works with no errors' do
pp = <<-EOS
class{ '::java': }
Expand All @@ -17,12 +16,12 @@
EOS

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_failures: true)
end

describe user('nexus') do
it { should belong_to_group 'nexus' }
it { is_expected.to belong_to_group 'nexus' }
end

describe service('nexus') do
Expand All @@ -34,14 +33,13 @@
describe port(8081) do
it {
sleep(180) # Waiting start up
should be_listening
is_expected.to be_listening
}
end

describe command('curl 0.0.0.0:8081/nexus/') do
its(:stdout) { should match /Sonatype Nexus&trade; 2.8.0-05/ }
its(:stdout) { is_expected.to match %r{Sonatype Nexus&trade; 2.8.0-05} }
end
end

end
end
14 changes: 6 additions & 8 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
require 'spec_helper_acceptance'

describe 'apt class' do

context 'default parameters' do
# Using puppet_apply as a helper
it 'should work with no errors' do
it 'works with no errors' do
pp = <<-EOS
class{ '::java': }
Expand All @@ -16,12 +15,12 @@
EOS

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_failures: true)
end

describe user('nexus') do
it { should belong_to_group 'nexus' }
it { is_expected.to belong_to_group 'nexus' }
end

describe service('nexus') do
Expand All @@ -33,14 +32,13 @@
describe port(8081) do
it {
sleep(90) # Waiting start up
should be_listening
is_expected.to be_listening
}
end

describe command('curl 0.0.0.0:8081/nexus/') do
its(:stdout) { should match /Sonatype Nexus&trade; 2.8.0-05/ }
its(:stdout) { is_expected.to match %r{Sonatype Nexus&trade; 2.8.0-05} }
end
end

end
end
14 changes: 6 additions & 8 deletions spec/acceptance/download_folder_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
require 'spec_helper_acceptance'

describe 'nexus class' do

context 'download folder parameter' do
# Using puppet_apply as a helper
it 'should work with no errors' do
it 'works with no errors' do
pp = <<-EOS
class{ '::java': }
Expand All @@ -17,12 +16,12 @@
EOS

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_failures: true)
end

describe user('nexus') do
it { should belong_to_group 'nexus' }
it { is_expected.to belong_to_group 'nexus' }
end

describe service('nexus') do
Expand All @@ -34,13 +33,12 @@
describe port(8081) do
it {
sleep(90) # Waiting start up
should be_listening
is_expected.to be_listening
}
end
describe command('curl 0.0.0.0:8081/nexus/') do
its(:stdout) { should match /Sonatype Nexus&trade; 2.8.0-05/ }
its(:stdout) { is_expected.to match %r{Sonatype Nexus&trade; 2.8.0-05} }
end
end

end
end
Loading

0 comments on commit dcfa583

Please sign in to comment.