mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-07 22:53:08 -06:00
158a90b25b
* Grafana provider * grafana_data_source resource. Allows data sources to be created in Grafana. Supports all data source types that are accepted in the current version of Grafana, and will support any future ones that fit into the existing structure. * Vendoring of apparentlymart/go-grafana-api This is in anticipation of adding a Grafana provider plugin. * grafana_dashboard resource * Website documentation for the Grafana provider.
55 lines
1.6 KiB
Go
55 lines
1.6 KiB
Go
package grafana
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
"github.com/hashicorp/terraform/terraform"
|
|
)
|
|
|
|
// To run these acceptance tests, you will need a Grafana server.
|
|
// Grafana can be downloaded here: http://grafana.org/download/
|
|
//
|
|
// The tests will need an API key to authenticate with the server. To create
|
|
// one, use the menu for one of your installation's organizations (The
|
|
// "Main Org." is fine if you've just done a fresh installation to run these
|
|
// tests) to reach the "API Keys" admin page.
|
|
//
|
|
// Giving the API key the Admin role is the easiest way to ensure enough
|
|
// access is granted to run all of the tests.
|
|
//
|
|
// Once you've created the API key, set the GRAFANA_URL and GRAFANA_AUTH
|
|
// environment variables to the Grafana base URL and the API key respectively,
|
|
// and then run:
|
|
// make testacc TEST=./builtin/providers/grafana
|
|
|
|
var testAccProviders map[string]terraform.ResourceProvider
|
|
var testAccProvider *schema.Provider
|
|
|
|
func init() {
|
|
testAccProvider = Provider().(*schema.Provider)
|
|
testAccProviders = map[string]terraform.ResourceProvider{
|
|
"grafana": testAccProvider,
|
|
}
|
|
}
|
|
|
|
func TestProvider(t *testing.T) {
|
|
if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
}
|
|
|
|
func TestProvider_impl(t *testing.T) {
|
|
var _ terraform.ResourceProvider = Provider()
|
|
}
|
|
|
|
func testAccPreCheck(t *testing.T) {
|
|
if v := os.Getenv("GRAFANA_URL"); v == "" {
|
|
t.Fatal("GRAFANA_URL must be set for acceptance tests")
|
|
}
|
|
if v := os.Getenv("GRAFANA_AUTH"); v == "" {
|
|
t.Fatal("GRAFANA_AUTH must be set for acceptance tests")
|
|
}
|
|
}
|