Module: Docker::Spec

Defined in:
lib/docker/spec/docker.rb,
lib/docker/spec/version.rb

Constant Summary collapse

VERSION =
"0.7.0"

Class Method Summary collapse

Class Method Details

.docker_tests ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/docker/spec/docker.rb', line 3

def self.docker_tests
  describe 'Running a docker container' do
    before(:all) do
      @config = DockerSpec.instance.config
      @image = Docker::Image.all.detect do |i|
        i.info['RepoTags'].include?(@config[:image_name] + ':latest')
      end
      @container = Docker::Container.all.select do |c|
        c.info["Names"] == [ "/" + @config[:container_name] ]
      end.first
    end

    it 'should be available' do
      expect(@image).to_not be_nil
    end

    it 'should have state running' do
      expect(@container.json['State']['Running']).to be true
    end

    it 'Should stay running' do
      expect(@container.json['State']['Running']).to be true
    end

    it 'Should not have exit processes' do
      expect(@container.logs(stdout: true)).to_not match(/exit/)
    end

    it 'Services supervisor should be running' do
      expect(process('supervisord')).to be_running
    end
  end
end