Commit 360940b1 authored by Robert May's avatar Robert May

Add basic FIPS class

Adds a simple class for storing FIPS helpers, including an initial
.enabled? method that just references a feature flag for now.

Changelog: added
parent 1a0c3a85
---
name: fips_mode
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/81418/diffs?view=inline
rollout_issue_url:
milestone: '14.9'
type: development
group: group::source code
default_enabled: false
......@@ -40,4 +40,5 @@ ActiveSupport::Inflector.inflections do |inflect|
inflect.acronym 'JH'
inflect.acronym 'CSP'
inflect.acronym 'VSCode'
inflect.acronym 'FIPS'
end
# rubocop: disable Naming/FileName
# frozen_string_literal: true
module Gitlab
class FIPS
# A simple utility class for FIPS-related helpers
class << self
# Returns whether we should be running in FIPS mode or not
#
# @return [Boolean]
def enabled?
Feature.enabled?(:fips_mode, default_enabled: :yaml)
end
end
end
end
# rubocop: enable Naming/FileName
# frozen_string_literal: true
require "spec_helper"
RSpec.describe Gitlab::FIPS do
describe ".enabled?" do
subject { described_class.enabled? }
context "feature flag is enabled" do
it { is_expected.to be_truthy }
end
context "feature flag is disabled" do
before do
stub_feature_flags(fips_mode: false)
end
it { is_expected.to be_falsey }
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