Commit 638d8a9e authored by Stefano Tenuta's avatar Stefano Tenuta

Fixed tests for jobs_request_post_spec

Added a test to validate Variables in jobs_request_post_spec
Updated other tests to expect an empty Variables property
parent a0b96c07
......@@ -443,7 +443,7 @@ FactoryBot.define do
options do
{
image: { name: 'ruby:2.7', entrypoint: '/bin/sh' },
services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }],
services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }, { name: 'mysql:latest', variables: { MYSQL_ROOT_PASSWORD: 'root123.' } }],
script: %w(echo),
after_script: %w(ls date),
artifacts: {
......
......@@ -218,9 +218,11 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
expect(json_response['git_info']).to eq(expected_git_info)
expect(json_response['image']).to eq({ 'name' => 'ruby:2.7', 'entrypoint' => '/bin/sh', 'ports' => [] })
expect(json_response['services']).to eq([{ 'name' => 'postgres', 'entrypoint' => nil,
'alias' => nil, 'command' => nil, 'ports' => [] },
'alias' => nil, 'command' => nil, 'ports' => [], 'variables' => nil },
{ 'name' => 'docker:stable-dind', 'entrypoint' => '/bin/sh',
'alias' => 'docker', 'command' => 'sleep 30', 'ports' => [] }])
'alias' => 'docker', 'command' => 'sleep 30', 'ports' => [], 'variables' => [] },
{ 'name' => 'mysql:latest', 'entrypoint' => nil,
'alias' => nil, 'command' => nil, 'ports' => [], 'variables' => [{ key: 'MYSQL_ROOT_PASSWORD', value: 'root123.' }.as_json] }])
expect(json_response['steps']).to eq(expected_steps)
expect(json_response['artifacts']).to eq(expected_artifacts)
expect(json_response['cache']).to eq(expected_cache)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment