Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: warn about using experimental features #945

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/config/env_notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ func ReadAndAppendShoutrrrURL(ppfmt pp.PP, key string, field *notifier.Notifier)
return true
}

ppfmt.Hintf(pp.HintExperimentalShoutrrr,
"You are using the experimental shoutrrr support added in version 1.12.0")

s, ok := notifier.NewShoutrrr(ppfmt, vals)
if !ok {
return false
Expand Down
15 changes: 11 additions & 4 deletions internal/config/env_notifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ func TestReadAndAppendShoutrrrURL(t *testing.T) {
t.Helper()
require.Nil(t, n)
},
true, nil,
true,
nil,
},
"empty": {
true, "", nil,
func(t *testing.T, n not) {
t.Helper()
require.Nil(t, n)
},
true, nil,
true,
nil,
},
"generic": {
true, "generic+https://example.com/api/v1/postStuff",
Expand All @@ -55,7 +57,9 @@ func TestReadAndAppendShoutrrrURL(t *testing.T) {
require.Equal(t, []string{"Generic"}, s.ServiceDescriptions)
},
true,
nil,
func(m *mocks.MockPP) {
m.EXPECT().Hintf(pp.HintExperimentalShoutrrr, "You are using the experimental shoutrrr support added in version 1.12.0") //nolint:lll
},
},
"ill-formed": {
true, "meow-meow-meow://cute",
Expand All @@ -66,6 +70,7 @@ func TestReadAndAppendShoutrrrURL(t *testing.T) {
},
false,
func(m *mocks.MockPP) {
m.EXPECT().Hintf(pp.HintExperimentalShoutrrr, "You are using the experimental shoutrrr support added in version 1.12.0") //nolint:lll
m.EXPECT().Noticef(pp.EmojiUserError, `Could not create shoutrrr client: %v`, gomock.Any())
},
},
Expand All @@ -82,7 +87,9 @@ func TestReadAndAppendShoutrrrURL(t *testing.T) {
require.Equal(t, []string{"Generic", "Pushover"}, s.ServiceDescriptions)
},
true,
nil,
func(m *mocks.MockPP) {
m.EXPECT().Hintf(pp.HintExperimentalShoutrrr, "You are using the experimental shoutrrr support added in version 1.12.0") //nolint:lll
},
},
} {
t.Run(name, func(t *testing.T) {
Expand Down
3 changes: 3 additions & 0 deletions internal/config/env_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ func ReadProvider(ppfmt pp.PP, key, keyDeprecated string, field *provider.Provid
)
return false
}
ppfmt.Hintf(pp.HintExperimentalLocalWithInterface,
`You are using the experimental provider "local:%s" added in version 1.15.0`,
parts[1])
*field = provider.NewLocalWithInterface(parts[1])
return true
case len(parts) == 2 && parts[0] == "url":
Expand Down
7 changes: 6 additions & 1 deletion internal/config/env_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ func TestReadProvider(t *testing.T) {
"cloudflare.doh": {true, " \tcloudflare.doh ", false, "", none, doh, true, nil},
"none": {true, " none ", false, "", trace, none, true, nil},
"local": {true, " local ", false, "", trace, local, true, nil},
"local:lo": {true, " local : lo ", false, "", trace, localLoopback, true, nil},
"local:lo": {
true, " local : lo ", false, "", trace, localLoopback, true,
func(m *mocks.MockPP) {
m.EXPECT().Hintf(pp.HintExperimentalLocalWithInterface, `You are using the experimental provider "local:%s" added in version 1.15.0`, "lo") //nolint:lll
},
},
"local:": {
true, " local: ", false, "", trace, trace, false,
func(m *mocks.MockPP) {
Expand Down
3 changes: 3 additions & 0 deletions internal/config/env_waf.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func ReadAndAppendWAFListNames(ppfmt pp.PP, key string, field *[]api.WAFList) bo
return true
}

ppfmt.Hintf(pp.HintExperimentalWAF,
"You're using the new WAF list manipulation feature added in version 1.14.0")

lists := make([]api.WAFList, 0, len(vals))

for _, val := range vals {
Expand Down
19 changes: 16 additions & 3 deletions internal/config/env_waf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ func TestReadAndAppendWAFListNames(t *testing.T) {
nil,
[]api.WAFList{{AccountID: "hey", Name: "hello"}},
true,
nil,
func(m *mocks.MockPP) {
m.EXPECT().Hintf(pp.HintExperimentalWAF,
"You're using the new WAF list manipulation feature added in version 1.14.0")
},
},
"two": {
true, "hey/hello,here/aloha",
nil,
[]api.WAFList{{AccountID: "hey", Name: "hello"}, {AccountID: "here", Name: "aloha"}},
true,
nil,
func(m *mocks.MockPP) {
m.EXPECT().Hintf(pp.HintExperimentalWAF,
"You're using the new WAF list manipulation feature added in version 1.14.0")
},
},
"one+two": {
true, "hey/hello,here/aloha",
Expand All @@ -53,14 +59,19 @@ func TestReadAndAppendWAFListNames(t *testing.T) {
{AccountID: "here", Name: "aloha"},
},
true,
nil,
func(m *mocks.MockPP) {
m.EXPECT().Hintf(pp.HintExperimentalWAF,
"You're using the new WAF list manipulation feature added in version 1.14.0")
},
},
"invalid-format": {
true, "+++",
[]api.WAFList{{AccountID: "there", Name: "ciao"}},
[]api.WAFList{{AccountID: "there", Name: "ciao"}},
false,
func(m *mocks.MockPP) {
m.EXPECT().Hintf(pp.HintExperimentalWAF,
"You're using the new WAF list manipulation feature added in version 1.14.0")
m.EXPECT().Noticef(pp.EmojiUserError, `List %q should be in format "account-id/list-name"`, "+++")
},
},
Expand All @@ -75,6 +86,8 @@ func TestReadAndAppendWAFListNames(t *testing.T) {
},
true,
func(m *mocks.MockPP) {
m.EXPECT().Hintf(pp.HintExperimentalWAF,
"You're using the new WAF list manipulation feature added in version 1.14.0")
m.EXPECT().Noticef(pp.EmojiUserWarning, "List name %q contains invalid character %q", "!!!", "!")
},
},
Expand Down
3 changes: 3 additions & 0 deletions internal/pp/hint.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ const (
HintMismatchedRecordAttributes
HintMismatchedWAFListAttributes
Hint1111Blockage
HintExperimentalShoutrrr // introduced in 1.12.0
HintExperimentalWAF // introduced in 1.14.0
HintExperimentalLocalWithInterface // introduced in 1.15.0
)
Loading