Skip to content

Commit 75701c0

Browse files
committed
Use the default theforeman/action action for smart proxy plugins.
1 parent 4501849 commit 75701c0

File tree

5 files changed

+29
-40
lines changed

5 files changed

+29
-40
lines changed

.github/workflows/ci.yml

+11-25
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
11
name: CI
22

3-
on:
4-
- pull_request
5-
- push
3+
on: pull_request
4+
5+
concurrency:
6+
group: ${{ github.ref_name }}-${{ github.workflow }}
7+
cancel-in-progress: true
68

79
jobs:
810
test:
9-
runs-on: ubuntu-latest
10-
strategy:
11-
fail-fast: false
12-
matrix:
13-
ruby:
14-
- "2.5"
15-
- "2.6"
16-
- "2.7"
17-
name: Ruby ${{ matrix.ruby }}
18-
steps:
19-
- uses: actions/checkout@v3
20-
- name: Install development headers
21-
run: sudo apt install libkrb5-dev libldap-dev libsasl2-dev -y
22-
- name: Install Ruby ${{ matrix.ruby }}
23-
uses: ruby/setup-ruby@v1
24-
with:
25-
ruby-version: ${{ matrix.ruby }}
26-
bundler-cache: true
27-
- name: Run tests
28-
run: bundle exec rake test
29-
- name: Verify gem builds
30-
run: gem build *.gemspec
11+
name: Tests
12+
uses: theforeman/actions/.github/workflows/smart_proxy_plugin.yml@v0
13+
with:
14+
extra_packages: "libkrb5-dev libldap-dev libsasl2-dev"
15+
16+

Rakefile

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ Rake::TestTask.new(:test) do |t|
1212
t.test_files = FileList['test/**/*_test.rb']
1313
t.verbose = true
1414
end
15+

smart_proxy_realm_ad_plugin.gemspec

+10-8
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@ Gem::Specification.new do |s|
55
s.name = 'smart_proxy_realm_ad_plugin'
66
s.version = Proxy::AdRealm::VERSION
77
s.date = Date.today.to_s
8-
s.license = 'GPL-3.0'
8+
s.license = 'GPL-3.0-only'
99
s.authors = ['Mårten Cassel']
1010
s.email = ['marten.cassel@gmail.com']
1111
s.homepage = 'https://github.com/theforeman/smart_proxy_realm_ad_plugin'
12+
s.required_ruby_version = '>= 3.0'
1213

1314
s.summary = "A realm ad provider plugin for Foreman's smart proxy"
14-
s.description = "A realm ad provider plugin for Foreman's smart proxy"
15+
s.description = "This plugin provides a realm ad provider for Foreman's smart proxy, allowing integration with Active Directory realms."
16+
1517

1618
s.files = Dir['{config,lib,bundler.d}/**/*'] + ['README.md', 'LICENSE']
1719
s.test_files = Dir['test/**/*']
1820

19-
s.add_development_dependency('rake')
20-
s.add_development_dependency('mocha')
21-
s.add_development_dependency('test-unit')
22-
s.add_dependency('rkerberos')
23-
s.add_dependency('radcli')
24-
end
21+
s.add_development_dependency('rake', '~> 13.2')
22+
s.add_development_dependency('mocha', '~> 2.7')
23+
s.add_development_dependency('test-unit', '~> 3.6')
24+
s.add_dependency('rkerberos', '~> 0.1')
25+
s.add_dependency('radcli', '~> 1.1')
26+
end

test/ad_provider_test.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def test_rebuild_host_returns_password
7272
end
7373

7474
def test_generate_password_returns_random_passwords
75-
assert_not_equal @provider.generate_password, @provider.generate_password
75+
refute_equal @provider.generate_password, @provider.generate_password
7676
end
7777

7878
def test_generate_password_returns_20_char_long_password
@@ -81,22 +81,22 @@ def test_generate_password_returns_20_char_long_password
8181

8282
def test_apply_computername_prefix_should_return_false_when_prefix_is_nil
8383
provider = Proxy::AdRealm::Provider.new(computername_prefix: nil, realm: 'example.com')
84-
assert_false provider.apply_computername_prefix?('host.example.com')
84+
refute provider.apply_computername_prefix?('host.example.com')
8585
end
8686

8787
def test_apply_computername_prefix_should_return_false_when_prefix_is_empty
8888
provider = Proxy::AdRealm::Provider.new(computername_prefix: '', realm: 'example.com')
89-
assert_false provider.apply_computername_prefix?('host.example.com')
89+
refute provider.apply_computername_prefix?('host.example.com')
9090
end
9191

9292
def test_apply_computername_prefix_should_return_false_when_hostname_contains_prefix
9393
provider = Proxy::AdRealm::Provider.new(computername_prefix: 'PREFIX-', realm: 'example.com')
94-
assert_false provider.apply_computername_prefix?('prefix-host.example.com')
94+
refute provider.apply_computername_prefix?('prefix-host.example.com')
9595
end
9696

9797
def test_apply_computername_prefix_should_return_true_when_computername_hash_is_used
9898
provider = Proxy::AdRealm::Provider.new(computername_prefix: 'PREFIX-', computername_hash: true, realm: 'example.com')
99-
assert_true provider.apply_computername_prefix?('host.example.com')
99+
assert provider.apply_computername_prefix?('host.example.com')
100100
end
101101

102102
def test_hostfqdn_to_computername_uses_prefix
@@ -119,7 +119,7 @@ def test_unrecognized_realm_raises_exception
119119
end
120120

121121
def test_find
122-
assert_true @provider.find('a_host_fqdn')
122+
assert @provider.find('a_host_fqdn')
123123
end
124124

125125
def test_delete

test/test_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require 'test/unit'
2-
require 'mocha/setup'
2+
require 'mocha/test_unit'
33

44
require 'smart_proxy_for_testing'
55

0 commit comments

Comments
 (0)