Skip to content

Commit 050d59a

Browse files
committed
add podman for integration test
1 parent 431ef81 commit 050d59a

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

.github/workflows/ruby.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434

3535
integration_test:
3636
runs-on: ubuntu-latest
37+
timeout-minutes: 120
3738

3839
services:
3940
docker:

.ruby-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/omnipackage_agent/config.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
require 'tmpdir'
55

66
require 'omnipackage_agent/utils/yaml'
7+
require 'omnipackage_agent/container_runtime'
78

89
module OmnipackageAgent
910
class Config
@@ -50,7 +51,7 @@ def initialize(hash, attributes = ATTRIBUTES) # rubocop: disable Metrics/MethodL
5051
end
5152

5253
if a == :container_runtime && value == 'auto'
53-
instance_variable_set("@#{a}", auto_detect_container_runtime)
54+
instance_variable_set("@#{a}", ::OmnipackageAgent::ContainerRuntime.auto_detect)
5455
else
5556
instance_variable_set("@#{a}", value)
5657
end
@@ -59,12 +60,5 @@ def initialize(hash, attributes = ATTRIBUTES) # rubocop: disable Metrics/MethodL
5960
end
6061
freeze
6162
end
62-
63-
private
64-
65-
def auto_detect_container_runtime
66-
possibilities = %w[podman docker]
67-
possibilities.find { |cmd| system("#{cmd} --version > /dev/null 2>&1") } || (raise "you have to install #{possibilities.join(' or ')}")
68-
end
6963
end
7064
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
module OmnipackageAgent
4+
module ContainerRuntime
5+
module_function
6+
7+
AVAILABLE = %w[podman docker].freeze
8+
9+
def auto_detect
10+
AVAILABLE.find { |cmd| system("#{cmd} --version > /dev/null 2>&1") } || (raise "you have to install #{AVAILABLE.join(' or ')}")
11+
end
12+
end
13+
end
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# frozen_string_literal: true
22

3-
require 'test_helper'
43
require 'minitest/fail_fast'
4+
5+
require 'test_helper'

test/integration/test_build_sample_project.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
class TestBuildSampleProject < ::Minitest::Test
66
%w[podman docker].each do |container_runtime|
7-
# next unless system("#{container_runtime} --version > /dev/null 2>&1")
8-
97
::OmnipackageAgent::Distro.each do |distro|
108
next if distro.deprecated
119

@@ -16,9 +14,7 @@ class TestBuildSampleProject < ::Minitest::Test
1614
end
1715

1816
def test_auto_detect_container_runtime
19-
cmd = ::OmnipackageAgent::Config.get.container_runtime
20-
21-
assert system("#{cmd} --version > /dev/null 2>&1")
17+
assert system("#{::OmnipackageAgent::ContainerRuntime.auto_detect} --version > /dev/null 2>&1")
2218
end
2319

2420
private

0 commit comments

Comments
 (0)