Skip to content

Commit

Permalink
(CAT-1807) Remove all reference of analytics from the acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
david22swan committed Apr 12, 2024
1 parent 4fa8aa0 commit a31c7ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
16 changes: 9 additions & 7 deletions spec/acceptance/get_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,28 @@
describe command('pdk get config') do
its(:exit_status) { is_expected.to eq 0 }
# This setting should appear in all pdk versions
its(:stdout) { is_expected.to match(/user\.analytics\.user-id=/) }
its(:stdout) { is_expected.to match(/user.module_defaults.author=/) }
its(:stderr) { is_expected.to have_no_output }
end

describe command('pdk get config user.analytics.disabled') do
describe command('pdk get config user.module_defaults.author') do
its(:exit_status) { is_expected.to eq 0 }
# This setting, and only, this setting should appear in output
its(:stdout) { is_expected.to eq("true\n") }
its(:stdout) { is_expected.to match("true\n") }
its(:stderr) { is_expected.to have_no_output }
end

describe command('pdk get config user.analytics') do
describe command('pdk get config user.module_defaults') do
its(:exit_status) { is_expected.to eq 0 }
# There should be two configuration items returned
its(:stdout) { expect(is_expected.target.split("\n").count).to eq(2) }
its(:stdout) { expect(is_expected.target.split("\n").count).to eq(4) }

its(:stdout) do
result = is_expected.target.split("\n").sort
expect(result[0]).to match('user.analytics.disabled=true')
expect(result[1]).to match(/user.analytics.user-id=.+/)
expect(result[0]).to match(/user.module_defaults.author=.+/)
expect(result[1]).to match(/user.module_defaults.forge_username=.+/)
expect(result[2]).to match(/user.module_defaults.license-url=.+/)
expect(result[3]).to match(/user.module_defaults.template-url=.+/)
end

its(:stderr) { is_expected.to have_no_output }
Expand Down
7 changes: 0 additions & 7 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def execute_script(script)
end

tempdir = nil
analytics_config = nil

# TODO: --path is deprecated
# bundler won't install bundler into the --path, so in order to access ::Bundler.with_unbundled_env
Expand Down Expand Up @@ -97,11 +96,6 @@ def execute_script(script)
Dir.chdir(tempdir)
puts "Working in #{tempdir}"

analytics_config = Tempfile.new('analytics.yml')
analytics_config.write(YAML.dump('disabled' => true))
analytics_config.close
ENV['PDK_ANALYTICS_CONFIG'] = analytics_config.path

# Remove PUPPET_GEM_VERSION if it exists in the test environment
ENV.delete('PUPPET_GEM_VERSION')
end
Expand All @@ -111,7 +105,6 @@ def execute_script(script)
FileUtils.rm_rf(tempdir)
FileUtils.rm_rf(RSpec.configuration.template_dir)
puts "Cleaned #{tempdir}"
analytics_config.unlink
end

c.after do |e|
Expand Down

0 comments on commit a31c7ff

Please sign in to comment.