From 741cf1016de0494976319e94df74bb0e23426f65 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 28 Oct 2020 16:45:45 -0600 Subject: Add test to verify that shelling out to rpm works --- spec/fixtures/docker/centos8-Dockerfile | 1 + spec/integration/klar_spec.rb | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/docker/centos8-Dockerfile (limited to 'spec') diff --git a/spec/fixtures/docker/centos8-Dockerfile b/spec/fixtures/docker/centos8-Dockerfile new file mode 100644 index 0000000..dd95913 --- /dev/null +++ b/spec/fixtures/docker/centos8-Dockerfile @@ -0,0 +1 @@ +FROM centos:8 diff --git a/spec/integration/klar_spec.rb b/spec/integration/klar_spec.rb index 1704af8..627ca9d 100644 --- a/spec/integration/klar_spec.rb +++ b/spec/integration/klar_spec.rb @@ -9,15 +9,31 @@ RSpec.describe 'klar' do { DOCKERFILE_PATH: project.path.join("minbox-Dockerfile"), DOCKER_IMAGE: "mokhan/minbox:latest", - SECURE_LOG_LEVEL: "debug" } end pending { expect(subject).to match_schema(:container_scanning) } specify do + expect(subject['scan']['status']).to eql('success') expect(subject['vulnerabilities'].length).to be > 0 expect(subject['vulnerabilities']).to all(include('category' => 'container_scanning')) end end + + context "when scanning a RHEL based image" do + let(:env) do + { + DOCKERFILE_PATH: project.path.join("centos8-Dockerfile"), + DOCKER_IMAGE: "centos:8", + } + end + + pending { expect(subject).to match_schema(:container_scanning) } + specify { expect(subject['scan']['status']).to eql('success') } + + it "can shell out to `rpm`" do + expect(docker.run(image: docker_image, project_path: project.path, env: env, command: 'rpm -q rpm')).to be(true) + end + end end -- cgit v1.2.3