test: ignore the pinned salt version in the _mapdata reference check

Pinning salt:version (previous commit) writes the running version into
salt_settings.version, but the _mapdata reference files are static and one
per OS — shared across the -3006/-3007/-master suites — so they can't carry a
per-image version. Drop salt_settings.version from both sides of the compare:
it now tracks the kitchen image's salt rather than a fixed default, so it's
not a value the static reference should assert.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Paul Tobias
2026-06-25 23:40:07 +07:00
co-authored by Claude
parent 5c894b9753
commit f418e6d8d8
@@ -24,6 +24,8 @@ control 'salt._mapdata' do
# Load the mapdata from profile, into a YAML structure # Load the mapdata from profile, into a YAML structure
# https://docs.chef.io/inspec/profiles/#profile-files # https://docs.chef.io/inspec/profiles/#profile-files
mapdata_file_yaml = YAML.load(inspec.profile.file(mapdata_file_path)) mapdata_file_yaml = YAML.load(inspec.profile.file(mapdata_file_path))
# salt_settings.version is pinned to the kitchen image's salt, so drop it
mapdata_file_yaml.dig('values', 'salt_settings')&.delete('version')
# Dump the YAML back into a string for comparison # Dump the YAML back into a string for comparison
mapdata_file_dump = YAML.dump(mapdata_file_yaml) mapdata_file_dump = YAML.dump(mapdata_file_yaml)
@@ -36,6 +38,8 @@ control 'salt._mapdata' do
# Load the output into a YAML structure using InSpec's `yaml` resource # Load the output into a YAML structure using InSpec's `yaml` resource
# https://github.com/inspec/inspec/blob/49b7d10/lib/inspec/resources/yaml.rb#L29 # https://github.com/inspec/inspec/blob/49b7d10/lib/inspec/resources/yaml.rb#L29
output_file_yaml = yaml(output_file_path).params output_file_yaml = yaml(output_file_path).params
# drop the image-pinned salt_settings.version here too
output_file_yaml.dig('values', 'salt_settings')&.delete('version')
# Dump the YAML back into a string for comparison # Dump the YAML back into a string for comparison
output_file_dump = YAML.dump(output_file_yaml) output_file_dump = YAML.dump(output_file_yaml)