Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix tests, remove EOL OSes, fix Ruby 3.4 compatibility warnings #421

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ tmp
.kitchen.local.yml
Dockerfile
.DS_Store
bin/*
.idea/*
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ gemspec
group :development do
# Integration testing gems.
gem 'kitchen-inspec', '~> 2.0'
gem 'inspec', '>= 4.26.2', '< 6.0'
gem 'train', '>= 2.1', '< 4.0' # validate 4.x when it's released
# Silence ruby 3.4.0 standard gem deprecation warnings
gem 'csv', '~> 3.3.0'
gem 'syslog', '~> 0.1.1'
end

group :test do
Expand Down
34 changes: 24 additions & 10 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,44 @@
---
driver:
name: docker
provision_command: curl -L https://www.chef.io/chef/install.sh | bash
# provision_command: curl -L https://www.chef.io/chef/install.sh | bash

transport:
name: docker

provisioner:
name: dummy

verifier:
name: inspec
inspec_tests:
- test/integration/inspec

platforms:
- name: amazonlinux-2
- name: ubuntu-18.04
# - name: amazonlinux-2023
- name: ubuntu-20.04
- name: ubuntu-22.04
- name: ubuntu-24.04
- name: fedora-latest
driver:
provision_command:
- yum install libxcrypt-compat -y
- curl -L https://www.chef.io/chef/install.sh | bash
- name: centos-7
- name: centos-stream-9
driver:
image: dokken/centos-stream-9
- name: oraclelinux-7
- name: rockylinux-8
- name: debian-11
- name: oraclelinux-8
- name: oraclelinux-9
- name: rockylinux-9
- name: debian-12
- name: opensuse-15
- name: opensuse-15.5
driver:
image: opensuse/leap:15.5
- name: opensuse-15.6
driver:
image: opensuse/leap:15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This slug should get you the latest without having to maintain the version here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up putting in the two versions separately because both of them showed to still be under active support on the website.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait I see what you mean. Specify a "latest v15" in addition to a "specific v15."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leap:15 should always be the latest

image: opensuse/leap:15.6
- name: dockerfile
driver:
username: dockerfile
Expand All @@ -42,7 +55,10 @@ suites:
driver:
build_context: false
- name: capabilities
includes: [debian-11, ubuntu-18.04, ubuntu-20.04]
includes:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
driver:
provision_command:
- curl -L https://www.chef.io/chef/install.sh | bash
Expand All @@ -58,5 +74,3 @@ suites:
- name: inspec
driver:
provision_command: true
verifier:
name: inspec
5 changes: 5 additions & 0 deletions lib/kitchen/docker/helpers/image_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def parse_image_id(output)
img_id = line.split(/\s+/).last
return img_id
end
# Docker ~v4.31 support
if line =~ /naming to moby-dangling@(sha256:[[:xdigit:]]{64})(?: \d*\.\ds)? done/i
img_id = line[/naming to moby-dangling@(sha256:[[:xdigit:]]{64})(?: \d*\.\ds)? done/i, 1]
return img_id
end
end
raise ActionFailed, "Could not parse Docker build output for image ID"
end
Expand Down
2 changes: 1 addition & 1 deletion test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM centos:7
FROM oraclelinux:7
RUN yum clean all

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the kitchen-dokken driver we switched to almalinux-9. Should probably do the same here for consistency and future proofing. Then the yum commands can be updated to dnf.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the Dockerfile and got it building successfully, but kitchen-docker complains the container isn't listening for ssh connections.

Perhaps I need to change the CMD to run the ssh server? It wasn't obvious to me why it worked with Oracle 7 but not Alma 9.

RUN yum install -y sudo openssh-server openssh-clients which curl htop
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
Expand Down
24 changes: 0 additions & 24 deletions test/integration/capabilities/disabled/capabilities_drop_spec.rb

This file was deleted.

24 changes: 0 additions & 24 deletions test/integration/default/disabled/default_spec.rb

This file was deleted.

21 changes: 0 additions & 21 deletions test/integration/default/disabled/spec_helper.rb

This file was deleted.

Loading