This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| steps: | |
| - label: ':hammer: Docker Test' | |
| command: | |
| - docker run --rm --name test-container -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/test -w /test saurabhthareja90/test-container spec/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "serverspec" | |
| require "docker" | |
| describe "Dockerfile" do | |
| before(:all) do | |
| @image = Docker::Image.build_from_dir('.') | |
| set :os, family: :alpine | |
| set :backend, :docker | |
| set :docker_image, @image.id | |
| set :docker_container_create_options, { 'Entrypoint' => ['ash'] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| output β | |
| .. | |
| Finished in 1.7 seconds (files took 0.43115 seconds to load) | |
| 2 examples, 0 failures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe docker.containers do | |
| its('images') { should include alpine:latest' } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| inspec exec image_spec.rb |
NewerOlder