From af29ddff50e5dd0e84deeafeb333f434317694f1 Mon Sep 17 00:00:00 2001 From: Jan Fooken Date: Tue, 1 Oct 2024 10:46:50 +0200 Subject: [PATCH] Remove all premium references The build files might need to get updated --- guides/check_definition.schema.json | 3 --- guides/specification.md | 14 -------------- lib/wanda/catalog.ex | 1 - lib/wanda/catalog/check.ex | 6 ++---- lib/wanda_web/schemas/v1/catalog/check.ex | 6 +++--- lib/wanda_web/schemas/v3/catalog/check.ex | 6 +++--- test/fixtures/catalog/expect_check.yaml | 1 - test/fixtures/catalog/expect_enum_check.yaml | 1 - test/support/factory.ex | 3 +-- test/wanda/catalog_test.exs | 6 ------ 10 files changed, 9 insertions(+), 38 deletions(-) diff --git a/guides/check_definition.schema.json b/guides/check_definition.schema.json index a6bece79..2313706b 100644 --- a/guides/check_definition.schema.json +++ b/guides/check_definition.schema.json @@ -27,9 +27,6 @@ "remediation": { "type": "string" }, - "premium": { - "type": "boolean" - }, "facts": { "type": "array", "items": { diff --git a/guides/specification.md b/guides/specification.md index 277923ea..cfe09d03 100644 --- a/guides/specification.md +++ b/guides/specification.md @@ -230,20 +230,6 @@ Reports a `critical` When the Check expectations do not pass severity: critical ``` -#### premium - -A boolean determining whether the check is premium or not. It doesn't have any real impact in the check execution itself, it is only an informative field, mostly used by the web frontend. - -**Default:** if no premium flag is provided, the system would default to `false` - -Example: - -Sets the check as premium - -```yaml -premium: true -``` - #### metadata A key-value map that enriches the Check being declared by providing extra information about when to consider it as applicable given a specific [env](#env) diff --git a/lib/wanda/catalog.ex b/lib/wanda/catalog.ex index 5483f3d9..a46c5e39 100644 --- a/lib/wanda/catalog.ex +++ b/lib/wanda/catalog.ex @@ -137,7 +137,6 @@ defmodule Wanda.Catalog do remediation: remediation, metadata: Map.get(check, "metadata"), when: Map.get(check, "when"), - premium: Map.get(check, "premium", false), severity: map_severity(check), facts: Enum.map(facts, &map_fact/1), values: map_values(check), diff --git a/lib/wanda/catalog/check.ex b/lib/wanda/catalog/check.ex index e75f670b..3de8c810 100644 --- a/lib/wanda/catalog/check.ex +++ b/lib/wanda/catalog/check.ex @@ -17,8 +17,7 @@ defmodule Wanda.Catalog.Check do :facts, :values, :expectations, - :when, - :premium + :when ] @type t :: %__MODULE__{ @@ -32,7 +31,6 @@ defmodule Wanda.Catalog.Check do facts: [Fact.t()], values: [Value.t()], expectations: [Expectation.t()], - when: String.t(), - premium: boolean() + when: String.t() } end diff --git a/lib/wanda_web/schemas/v1/catalog/check.ex b/lib/wanda_web/schemas/v1/catalog/check.ex index 41252ee2..1c38ffdd 100644 --- a/lib/wanda_web/schemas/v1/catalog/check.ex +++ b/lib/wanda_web/schemas/v1/catalog/check.ex @@ -111,7 +111,8 @@ defmodule WandaWeb.Schemas.V1.Catalog.Check do }, premium: %Schema{ type: :boolean, - description: "Check is Premium or not" + description: "Check is Premium or not", + deprecated: true } }, required: [ @@ -125,8 +126,7 @@ defmodule WandaWeb.Schemas.V1.Catalog.Check do :facts, :values, :expectations, - :when, - :premium + :when ] }, struct?: false diff --git a/lib/wanda_web/schemas/v3/catalog/check.ex b/lib/wanda_web/schemas/v3/catalog/check.ex index e8281b4b..0566c00e 100644 --- a/lib/wanda_web/schemas/v3/catalog/check.ex +++ b/lib/wanda_web/schemas/v3/catalog/check.ex @@ -117,7 +117,8 @@ defmodule WandaWeb.Schemas.V3.Catalog.Check do }, premium: %Schema{ type: :boolean, - description: "Check is Premium or not" + description: "Check is Premium or not", + deprecated: true } }, required: [ @@ -131,8 +132,7 @@ defmodule WandaWeb.Schemas.V3.Catalog.Check do :facts, :values, :expectations, - :when, - :premium + :when ] }, struct?: false diff --git a/test/fixtures/catalog/expect_check.yaml b/test/fixtures/catalog/expect_check.yaml index 9ce2e639..78eb267c 100644 --- a/test/fixtures/catalog/expect_check.yaml +++ b/test/fixtures/catalog/expect_check.yaml @@ -6,7 +6,6 @@ description: | remediation: | ## Remediation Remediation text -premium: true facts: - name: jedi gatherer: wandalorian diff --git a/test/fixtures/catalog/expect_enum_check.yaml b/test/fixtures/catalog/expect_enum_check.yaml index f27b7f46..785e98bf 100644 --- a/test/fixtures/catalog/expect_enum_check.yaml +++ b/test/fixtures/catalog/expect_enum_check.yaml @@ -6,7 +6,6 @@ description: | remediation: | ## Remediation Remediation text -premium: true facts: - name: jedi gatherer: wandalorian diff --git a/test/support/factory.ex b/test/support/factory.ex index b407f936..3e280d59 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -36,8 +36,7 @@ defmodule Wanda.Factory do facts: build_list(10, :catalog_fact), values: build_list(10, :catalog_value), expectations: build_list(10, :catalog_expectation), - when: Faker.Lorem.sentence(), - premium: Enum.random([false, true]) + when: Faker.Lorem.sentence() } end diff --git a/test/wanda/catalog_test.exs b/test/wanda/catalog_test.exs index d55b3efc..4c470225 100644 --- a/test/wanda/catalog_test.exs +++ b/test/wanda/catalog_test.exs @@ -95,7 +95,6 @@ defmodule Wanda.CatalogTest do description: "Just a check\n", remediation: "## Remediation\nRemediation text\n", severity: :critical, - premium: true, facts: [ %Fact{ name: "jedi", @@ -194,11 +193,6 @@ defmodule Wanda.CatalogTest do Catalog.get_check(catalog_path(), "warning_severity_check") end - test "should load premium as false by default" do - assert {:ok, %Check{premium: false}} = - Catalog.get_check(catalog_path(), "warning_severity_check") - end - test "should return an error for non-existent check" do assert {:error, _} = Catalog.get_check(catalog_path(), "non_existent_check") end