Make it easier to design GitLab QA components
GitLab QA test suite consist of multiple elements that call Capybara or Docker Engine. Currently these components do not have unit test because we test these in the CI anyway since these components are a part of integration tests framework.
Not having good unit tests for components that are Docker / Capybara wrappers might be considered as a technical debt that we accepted to make progress with GitLab QA faster.
Now, it is evident that lack of unit tests for wrapper-classes had a negative impact on the design of GitLab QA. This is not a problem yet because we have just a few wrapper-classes like this, but being able to apply Test Driven Development principles, to design wrapper-classes better, would be helpful.
The only thing that needs to be done to make it possible is having docker
stub in the internal RSpec test suite.
In other words, we need to be able to write specs for docker components like this:
describe Gitlab::QA::Component::Runner, :docker do
describe '#start!' do
it 'starts a container with the component' do
expect { subject.start! }
.to pull_image('docker/repository:tag')
.and run_container(/container-name-regex/)
end
end
end
Because we have a Docker::Engine
class that we create an instance of within each docker-wrapper component, we can inject a test double there and create a set of custom RSpec matchers / expectations.