Skip to content

Instantly share code, notes, and snippets.

View saurabhthareja90's full-sized avatar
💭
I may be slow to respond.

saurabh thareja saurabhthareja90

💭
I may be slow to respond.
View GitHub Profile
describe docker_image('alpine:latest') do
it { should exist }
its('image') { should eq 'alpine:latest' }
its('repo') { should eq 'alpine' }
its('tag') { should eq 'latest' }
end
inspec exec image_spec.rb
Profile: tests from image_spec.rb (tests from image_spec.rb)
Version: (not specified)
Target: local://
Docker Image alpine:latest
× should exist
expected Docker Image alpine:latest to exist
× image should eq "alpine:latest"
expected: "alpine:latest"
Profile: tests from image_spec.rb (tests from image_spec.rb)
Version: (not specified)
Target: local://
Docker Image alpine:latest
✔ should exist
✔ image should eq "alpine:latest"
✔ repo should eq "alpine"
✔ tag should eq "latest"
describe docker.containers do
its('images') { should include alpine:latest' }
end
Profile: tests from container_spec.rb (tests from container_spec.rb)
Version: (not specified)
Target: local://
#<Inspec::Resources::DockerContainerFilter:0x00007f96f664c5f0>
× images should include "alpine:latest"
expected ["redis-inmemory-with-node_node-app", "redis"] to include "alpine:latest"
Test Summary: 0 successful, 1 failure, 0 skipped
Profile: tests from container_spec.rb (tests from container_spec.rb)
Version: (not specified)
Target: local://
#<Inspec::Resources::DockerContainerFilter:0x00007faf6b295d48>
✔ images should include "alpine:latest"
Test Summary: 1 successful, 0 failures, 0 skipped
FROM ruby:2.6.5-alpine3.10
RUN apk add --update --no-cache build-base
RUN gem install docker-api
RUN gem install rspec
RUN gem install rspec_junit_formatter
RUN gem install serverspec
ENTRYPOINT ["rspec"]
output –
..
Finished in 1.7 seconds (files took 0.43115 seconds to load)
2 examples, 0 failures