Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix successThreshold, validate server protocol, deprecate scheme (#792)
* fix: success parameter in probes; restructure probes generation Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * chore: rewrite probe scheme logic Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * fix: remove probe scheme duplication Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * chore: improve code readability Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * chore: refactor probes Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * chore: add tests for probes Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * deprecate scheme in probes Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * validate server protocol through crds Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * update latest crds Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * update bundle crds Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * Rename test Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * Bring scheme back to avoid any incompatibility in v4 * Update CRDs Signed-off-by: Igor Beliakov <demtis.register@gmail.com> * update tests to make them use ProbeHandler Signed-off-by: Igor Beliakov <demtis.register@gmail.com> Co-authored-by: Hubert Stefanski <35736504+HubertStefanski@users.noreply.github.com>
- Loading branch information
1 parent
4b1c75b
commit 1ff83ec
Showing
9 changed files
with
299 additions
and
112 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
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,66 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
v1 "k8s.io/api/core/v1" | ||
) | ||
|
||
func TestGrafana_GetScheme(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
cr *Grafana | ||
want v1.URIScheme | ||
}{ | ||
{ | ||
name: "Nil server spec", | ||
cr: &Grafana{}, | ||
want: v1.URISchemeHTTP, | ||
}, | ||
{ | ||
name: "Empty server spec", | ||
cr: &Grafana{ | ||
Spec: GrafanaSpec{ | ||
Config: GrafanaConfig{ | ||
Server: &GrafanaConfigServer{}, | ||
}, | ||
}, | ||
}, | ||
want: v1.URISchemeHTTP, | ||
}, | ||
{ | ||
name: "HTTP in server spec", | ||
cr: &Grafana{ | ||
Spec: GrafanaSpec{ | ||
Config: GrafanaConfig{ | ||
Server: &GrafanaConfigServer{ | ||
Protocol: "http", | ||
}, | ||
}, | ||
}, | ||
}, | ||
want: v1.URISchemeHTTP, | ||
}, | ||
{ | ||
name: "HTTPS in server spec", | ||
cr: &Grafana{ | ||
Spec: GrafanaSpec{ | ||
Config: GrafanaConfig{ | ||
Server: &GrafanaConfigServer{ | ||
Protocol: "https", | ||
}, | ||
}, | ||
}, | ||
}, | ||
want: v1.URISchemeHTTPS, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got := tt.cr.GetScheme() | ||
assert.Equal(t, tt.want, got) | ||
}) | ||
} | ||
} |
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
Oops, something went wrong.