Alerting: Add support for alpha rules apis in legacy storage
Rules created in the new api makes the rule have no group in the database, but the rule is returned in the old group api with a sentinel group name formatted with the rule uid for compatiblity with the old api. This makes the UI continue to work with the rules without a group, and the ruler will continue to work with the rules without a group. Rules are not allowed to be created in the provisioning api with a NoGroup sentinel mask, but NoGroup rules can be manipulated through both the new and old apis. Co-authored-by: William Wernert <william.wernert@grafana.com>
This commit is contained in:
committed by
Moustafa Baiou
co-authored by
William Wernert
parent
0a85a30642
commit
ca8324e62a
@@ -59,9 +59,10 @@ const (
|
||||
)
|
||||
|
||||
type K8sTestHelper struct {
|
||||
t *testing.T
|
||||
env server.TestEnv
|
||||
Namespacer request.NamespaceMapper
|
||||
t *testing.T
|
||||
listenerAddress string
|
||||
env server.TestEnv
|
||||
Namespacer request.NamespaceMapper
|
||||
|
||||
Org1 OrgUsers // default
|
||||
OrgB OrgUsers // some other id
|
||||
@@ -88,12 +89,13 @@ func NewK8sTestHelper(t *testing.T, opts testinfra.GrafanaOpts) *K8sTestHelper {
|
||||
// The flag only exists to support the transition from the old to the new behavior in dev/ops/prod.
|
||||
opts.EnableFeatureToggles = append(opts.EnableFeatureToggles, featuremgmt.FlagAppPlatformGrpcClientAuth)
|
||||
dir, path := testinfra.CreateGrafDir(t, opts)
|
||||
_, env := testinfra.StartGrafanaEnv(t, dir, path)
|
||||
listenerAddress, env := testinfra.StartGrafanaEnv(t, dir, path)
|
||||
|
||||
c := &K8sTestHelper{
|
||||
env: *env,
|
||||
t: t,
|
||||
Namespacer: request.GetNamespaceMapper(nil),
|
||||
env: *env,
|
||||
listenerAddress: listenerAddress,
|
||||
t: t,
|
||||
Namespacer: request.GetNamespaceMapper(nil),
|
||||
}
|
||||
|
||||
cfgProvider, err := configprovider.ProvideService(c.env.Cfg)
|
||||
@@ -151,6 +153,10 @@ func (c *K8sTestHelper) GetEnv() server.TestEnv {
|
||||
return c.env
|
||||
}
|
||||
|
||||
func (c *K8sTestHelper) GetListenerAddress() string {
|
||||
return c.listenerAddress
|
||||
}
|
||||
|
||||
func (c *K8sTestHelper) Shutdown() {
|
||||
err := c.env.Server.Shutdown(context.Background(), "done")
|
||||
require.NoError(c.t, err)
|
||||
|
||||
Reference in New Issue
Block a user