Provisioning: refactor dry-run and run logic to be stricter and more concise (#103357)

* Separate DryRun into separate method

* Fix linting

* Remove errors

* Remove checks in dualwriter

* Fix unit tests

* Add TODOs

* Dry Run as non-critical error

* Add TODOs

* Address TODO

* Fix tests

* Fix linting

* Deprecate dashboard name from path completely

* Use MissingName error also in parser

* Return 206 for non-critical errors

* Remove TODOs for previous dry-run
This commit is contained in:
Roberto Jiménez Sánchez
2025-04-04 13:31:48 +03:00
committed by GitHub
parent 02c8669ee8
commit ea02e2e081
12 changed files with 161 additions and 225 deletions
@@ -101,15 +101,14 @@ spec:
},
}
// try to validate (and lint)
validate := true
// Support dashboard conversion
parsed, err := parser.Parse(context.Background(), info, validate)
require.Error(t, err) // no clients configured!
parsed, err := parser.Parse(context.Background(), info)
require.EqualError(t, err, "no clients configured")
err = parsed.DryRun(context.Background())
require.EqualError(t, err, "no client configured")
require.Equal(t, provisioning.ClassicDashboard, parsed.Classic)
require.Equal(t, &schema.GroupVersionKind{
require.Equal(t, schema.GroupVersionKind{
Group: "dashboard.grafana.app",
Version: "v0alpha1",
Kind: "Dashboard",