diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 062d03d..934bdc6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,3 +34,10 @@ jobs: - uses: actions/checkout@v3 - run: docker-compose build rspec-3.1 - run: docker-compose run rspec-3.1 + + build-3-2: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: docker-compose build rspec-3.2 + - run: docker-compose run rspec-3.2 diff --git a/docker-compose.yaml b/docker-compose.yaml index 9adb034..d6ab92a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -27,4 +27,11 @@ services: BASE_IMAGE: ruby:3.1 volumes: - .:/app + rspec-3.2: + build: + context: . + args: + BASE_IMAGE: ruby:3.2 + volumes: + - .:/app entrypoint: bundle exec rspec diff --git a/k8s-ruby.gemspec b/k8s-ruby.gemspec index e8541c0..742bb5a 100644 --- a/k8s-ruby.gemspec +++ b/k8s-ruby.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.bindir = "bin" spec.executables = [] spec.require_paths = ["lib"] - spec.required_ruby_version = spec.required_ruby_version = [">= 2.4", "< 3.2"] + spec.required_ruby_version = spec.required_ruby_version = [">= 2.4", "<= 3.2.2"] spec.add_runtime_dependency "excon", "~> 0.71" spec.add_runtime_dependency "dry-struct", "<= 1.6.0" diff --git a/spec/k8s/client_spec.rb b/spec/k8s/client_spec.rb index a035aa7..ea194ac 100644 --- a/spec/k8s/client_spec.rb +++ b/spec/k8s/client_spec.rb @@ -34,7 +34,6 @@ subject { described_class } context 'from KUBE_CA/KUBE_SERVER/KUBE_TOKEN variables' do - let(:server) { "localhost" } let(:env) { { 'KUBE_TOKEN' => token, 'KUBE_CA' => ca, 'KUBE_SERVER' => server } } @@ -125,11 +124,16 @@ context 'from default file locations' do before do - stub_const("ENV", {}) # ensure ENV['KUBECONFIG'] is not used - expect(File).to receive(:exist?).with(default_kubeconfig_path).and_return(false) - expect(File).to receive(:exist?).with('/etc/kubernetes/admin.conf').and_return(false) - expect(File).to receive(:exist?).with('/etc/kubernetes/kubelet.conf').and_return(true) - expect(File).to receive(:readable?).with('/etc/kubernetes/kubelet.conf').and_return(true) + stub_const("ENV", { 'KUBECONFIG' => nil }) # ensure ENV['KUBECONFIG'] is not used + + allow(File).to receive(:read).and_call_original + allow(File).to receive(:exist?).and_call_original + allow(File).to receive(:readable?).and_call_original + + allow(File).to receive(:exist?).with(default_kubeconfig_path).and_return(false) + allow(File).to receive(:exist?).with('/etc/kubernetes/admin.conf').and_return(false) + allow(File).to receive(:exist?).with('/etc/kubernetes/kubelet.conf').and_return(true) + allow(File).to receive(:readable?).with('/etc/kubernetes/kubelet.conf').and_return(true) end it 'loads a file if found' do