From b5d98289e3724bc9bd3f7782a7a99e2fcf90907d Mon Sep 17 00:00:00 2001 From: Hitesh Raghuvanshi <hraghuvanshi@gitlab.com> Date: Fri, 12 Apr 2024 15:51:38 +0530 Subject: [PATCH] Not throwing error when token not present Changelog: changed --- lib/gitlab/audit/ci_runner_token_author.rb | 2 +- spec/lib/gitlab/audit/ci_runner_token_author_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/audit/ci_runner_token_author.rb b/lib/gitlab/audit/ci_runner_token_author.rb index 5f83725b5a303..2ace983688e90 100644 --- a/lib/gitlab/audit/ci_runner_token_author.rb +++ b/lib/gitlab/audit/ci_runner_token_author.rb @@ -14,7 +14,7 @@ def initialize(audit_event) token = audit_event.details[:runner_registration_token] name = "Registration token: #{token}" else - raise ArgumentError, 'Runner token missing' + name = "Token not available" end super(id: -1, name: name) diff --git a/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb b/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb index 89664c5708468..6718760e92019 100644 --- a/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb +++ b/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb @@ -34,8 +34,8 @@ {} end - it 'raises ArgumentError' do - expect { subject }.to raise_error ArgumentError, 'Runner token missing' + it 'returns token not available' do + is_expected.to have_attributes(id: -1, name: 'Token not available') end end end -- GitLab