Provisioning: Add validation for missing organisations in datasource, dashboard, and notifier configurations (#26601)
* Provisioning: Check that org. from config exists Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com> * Apply suggestions from code review Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix some code after applying suggestions Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com> * Add negative test case Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com> Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
co-authored by
Arve Knudsen
parent
3f21283655
commit
ba2524cd88
@@ -36,6 +36,7 @@ func TestDatasourceAsConfig(t *testing.T) {
|
||||
bus.AddHandler("test", mockUpdate)
|
||||
bus.AddHandler("test", mockGet)
|
||||
bus.AddHandler("test", mockGetAll)
|
||||
bus.AddHandler("test", mockGetOrg)
|
||||
|
||||
Convey("apply default values when missing", func() {
|
||||
dc := newDatasourceProvisioner(logger)
|
||||
@@ -296,3 +297,7 @@ func mockGet(cmd *models.GetDataSourceByNameQuery) error {
|
||||
|
||||
return models.ErrDataSourceNotFound
|
||||
}
|
||||
|
||||
func mockGetOrg(_ *models.GetOrgByIdQuery) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user