Skip to content

Commit

Permalink
Remove all premium references
Browse files Browse the repository at this point in the history
The build files might need to get updated
  • Loading branch information
janvhs committed Oct 1, 2024
1 parent ea9e8ed commit af29ddf
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 38 deletions.
3 changes: 0 additions & 3 deletions guides/check_definition.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
"remediation": {
"type": "string"
},
"premium": {
"type": "boolean"
},
"facts": {
"type": "array",
"items": {
Expand Down
14 changes: 0 additions & 14 deletions guides/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion lib/wanda/catalog.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 2 additions & 4 deletions lib/wanda/catalog/check.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ defmodule Wanda.Catalog.Check do
:facts,
:values,
:expectations,
:when,
:premium
:when
]

@type t :: %__MODULE__{
Expand All @@ -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
6 changes: 3 additions & 3 deletions lib/wanda_web/schemas/v1/catalog/check.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -125,8 +126,7 @@ defmodule WandaWeb.Schemas.V1.Catalog.Check do
:facts,
:values,
:expectations,
:when,
:premium
:when
]
},
struct?: false
Expand Down
6 changes: 3 additions & 3 deletions lib/wanda_web/schemas/v3/catalog/check.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -131,8 +132,7 @@ defmodule WandaWeb.Schemas.V3.Catalog.Check do
:facts,
:values,
:expectations,
:when,
:premium
:when
]
},
struct?: false
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/catalog/expect_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ description: |
remediation: |
## Remediation
Remediation text
premium: true
facts:
- name: jedi
gatherer: wandalorian
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/catalog/expect_enum_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ description: |
remediation: |
## Remediation
Remediation text
premium: true
facts:
- name: jedi
gatherer: wandalorian
Expand Down
3 changes: 1 addition & 2 deletions test/support/factory.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 0 additions & 6 deletions test/wanda/catalog_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit af29ddf

Please sign in to comment.