Commit 3ab01363 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add test for evaluating secret variables in a policy

parent da6bfd9b
...@@ -48,13 +48,21 @@ describe Gitlab::Ci::Build::Policy::Variables do ...@@ -48,13 +48,21 @@ describe Gitlab::Ci::Build::Policy::Variables do
expect(policy).to be_satisfied_by(pipeline, seed) expect(policy).to be_satisfied_by(pipeline, seed)
end end
it 'allows to evaluate regular secret variables' do
secret = create(:ci_variable, project: project,
key: 'SECRET',
value: 'secret value')
policy = described_class.new(["$SECRET == 'secret value'"])
expect(policy).to be_satisfied_by(pipeline, seed)
end
it 'does not persist neither pipeline nor build' do it 'does not persist neither pipeline nor build' do
described_class.new('$VAR').satisfied_by?(pipeline, seed) described_class.new('$VAR').satisfied_by?(pipeline, seed)
expect(pipeline).not_to be_persisted expect(pipeline).not_to be_persisted
expect(seed.to_resource).not_to be_persisted expect(seed.to_resource).not_to be_persisted
end end
pending 'test for secret variables'
end end
end end
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