-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a `ServingConfig` model and a representation of the existing default serving configuration, allowing us to remove the more specific environment variable/app configuration.
- Loading branch information
Showing
5 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Represents a serving config on Discovery Engine. | ||
# | ||
# A serving config is an endpoint on an engine that can be used for | ||
# querying. Each serving config can have different configuration (in particular, different sets of | ||
# active controls), which allows us to test out new configuration changes outside of the default | ||
# serving config. | ||
# | ||
# see https://cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1beta/latest/Google-Cloud-DiscoveryEngine-V1beta-ServingConfig | ||
ServingConfig = Data.define(:remote_resource_id) do | ||
include DiscoveryEngineNameable | ||
|
||
# The default serving config automatically available on an engine | ||
def self.default | ||
new("default_search") | ||
end | ||
|
||
def parent | ||
# We only use a single engine in our architecture, so we can hardcode it here. | ||
Engine.default | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
RSpec.describe ServingConfig do | ||
subject(:serving_config) { described_class.new("my-serving-config") } | ||
|
||
describe ".default" do | ||
it "returns the default serving config" do | ||
expect(described_class.default).to eq(described_class.new("default_search")) | ||
end | ||
end | ||
|
||
describe "#name" do | ||
it "returns the fully qualified name of the serving config" do | ||
expect(subject.name).to eq("[collection]/engines/govuk/servingConfigs/my-serving-config") | ||
Check failure on line 12 in spec/models/serving_config_spec.rb GitHub Actions / Lint Ruby / Run RuboCop
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters