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:
Maksim Nabokikh
2020-07-30 12:59:12 +03:00
committed by GitHub
co-authored by Arve Knudsen
parent 3f21283655
commit ba2524cd88
8 changed files with 119 additions and 16 deletions
@@ -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
}