From 30f6c7e2e6a3d92f882cd6b4c5f2714ad0a7b5a5 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 20 May 2024 11:38:26 +1000 Subject: [PATCH] Set test on PR only --- .github/workflows/integration_test.yml | 34 ++++++++++++-------------- .github/workflows/pwsh_lint.yml | 4 +-- spec/acceptance/linux_spec.rb | 32 +++++------------------- 3 files changed, 24 insertions(+), 46 deletions(-) diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 79de60d0..80cb4110 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -1,9 +1,9 @@ name: "integration" on: - push: + pull_request: branches: - - feature_* + - "main" jobs: @@ -30,11 +30,9 @@ jobs: bundle env echo ::endgroup:: - # - name: modify sudo settings - # run: | - # sudo sed -i 's/Defaults env_reset//' /etc/sudoers - # sudo cat /etc/sudoers - # sudo find /etc/sudoers.d/ -exec cat {} \; + - name: modify sudo settings + run: | + sudo sed -i 's/Defaults env_reset//' /etc/sudoers - name: Create the fixtures directory run: | @@ -60,19 +58,19 @@ jobs: curl -k https://localhost:8140/packages/current/install.bash -I sudo -E /opt/hostedtoolcache/Ruby/2.7.8/x64/bin/bundle exec bolt --modulepath spec/fixtures/modules task run bootstrap --targets localhost master=localhost certname=testing123.com - Integration_windows: - runs-on: windows-latest - env: - PUPPET_GEM_VERSION: '~> 7.24' - FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set? + # Integration_windows: Currently no way to test Windows agent installation. + # runs-on: windows-latest + # env: + # PUPPET_GEM_VERSION: '~> 7.24' + # FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' # why is this set? - steps: - - name: enable long file path - run: | - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force - - name: checkout source - uses: actions/checkout@v4 + # steps: + # - name: enable long file path + # run: | + # New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force + # - name: checkout source + # uses: actions/checkout@v4 # - name: Activate Ruby 3.2 # uses: ruby/setup-ruby@v1 diff --git a/.github/workflows/pwsh_lint.yml b/.github/workflows/pwsh_lint.yml index a388d738..dda227e3 100644 --- a/.github/workflows/pwsh_lint.yml +++ b/.github/workflows/pwsh_lint.yml @@ -2,9 +2,9 @@ name: "pwsh_lint" on: - push: + pull_request: branches: - - feature_* + - "main" jobs: pwsh_lint: diff --git a/spec/acceptance/linux_spec.rb b/spec/acceptance/linux_spec.rb index 524d7cca..2ab5aa4a 100644 --- a/spec/acceptance/linux_spec.rb +++ b/spec/acceptance/linux_spec.rb @@ -13,31 +13,11 @@ def return_hostname end describe 'bootstrap task' do - include BoltSpec::Run - let(:bolt_config) { { 'modulepath' => RSpec.configuration.module_path } } - let(:bootstrap_dir) { File.join(RSpec.configuration.module_path, '../docker_provision') } - # let(:expected_default_output) { { 'clivar' => 'override', 'tfstatevar' => 'foo' } } - # let(:expected_modified_output) { { 'clivar' => 'foo', 'tfstatevar' => 'bar' } } - # let(:var_file) { 'tfvar_alternate.tfvars' } - # describe 'install' do - # it 'installs the agent', pending: 'Test needs re-written and nodesets fixed' do - # on(master, "puppet cert list #{return_hostname}").stdout.match(%r{[0-9A-F:]{95}})[0] if pe_install? - # result = run_task(task_name: 'bootstrap::linux', params: "master=#{return_hostname} cacert_content=\"$(cat /etc/puppetlabs/puppet/ssl/certs/ca.pem)\"") - # expect_multiple_regexes(result: result, regexes: [%r{Installed}, %r{Job completed. 1/1 nodes succeeded|Ran on 1 node}]) - # end - # end - - before(:all) do - bolt_config = { 'modulepath' => RSpec.configuration.module_path } - bootstrap_dir = File.join(RSpec.configuration.module_path, '../docker_provision') - puts bolt_config - puts bootstrap_dir - result = run_plan('deploy_pe::provision_master', 'targets' => 'localhost', 'version' => '2021.7.8') - expect(result['status']).to eq('success') - end - - it 'installs Puppet agent' do - result = run_task('bootstrap', 'localhost', { 'master' => 'localhost', 'certname' => 'testing123.com' }) - expect(result['status']).to eq('success') + describe 'install' do + it 'installs the agent', pending: 'Test needs re-written and nodesets fixed' do + on(master, "puppet cert list #{return_hostname}").stdout.match(%r{[0-9A-F:]{95}})[0] if pe_install? + result = run_task(task_name: 'bootstrap::linux', params: "master=#{return_hostname} cacert_content=\"$(cat /etc/puppetlabs/puppet/ssl/certs/ca.pem)\"") + expect_multiple_regexes(result: result, regexes: [%r{Installed}, %r{Job completed. 1/1 nodes succeeded|Ran on 1 node}]) + end end end