Documentation
¶
Index ¶
- Constants
- func SkipIfShort(t *testing.T)
- type GitHub
- type Grafana
- func (g *Grafana) AssertDashboardDoesNotExist(t assert.TestingT, apiKey, namespace, name string)
- func (g *Grafana) AssertDashboardExists(t assert.TestingT, apiKey, namespace, name string)
- func (g *Grafana) CreateAPIKey(t *testing.T, name string, orgID int) string
- func (g *Grafana) CreateDashboard(t *testing.T, apiKey, namespace, name string)
- func (g *Grafana) CreateDashboardWithTags(t *testing.T, apiKey, namespace, name string, tags []string)
- func (g *Grafana) CreateOrganisation(t testing.TB, name string) int
- func (g *Grafana) Host() string
- func (g *Grafana) ViewDashboardInUI(t testing.TB, apiKey, namespace, name string)
- type LogEntry
- type Loki
Constants ¶
const (
// DefaultOrgID is the ID of the default organisation in Grafana.
DefaultOrgID = 1
)
Variables ¶
This section is empty.
Functions ¶
func SkipIfShort ¶
Types ¶
type GitHub ¶
type GitHub struct {
// contains filtered or unexported fields
}
GitHub starts an httptest.Server that emulates the GitHub API. The server responds only to requests for:
- GET /repos/:owner/:repo/contents/:path - Returns file metadata or 404 if file doesn't exist.
- PUT /repos/:owner/:repo/contents/:path - Creates or updates files.
The server is automatically stopped by t.Cleanup().
See documentation.
type Grafana ¶
type Grafana struct {
// contains filtered or unexported fields
}
func NewGrafana ¶
func NewGrafana(t *testing.T, logConsumers ...testcontainers.LogConsumer) *Grafana
func (*Grafana) AssertDashboardDoesNotExist ¶
func (*Grafana) AssertDashboardExists ¶
func (*Grafana) CreateAPIKey ¶
CreateAPIKey creates a Grafana API key with admin permissions using the service account API.
func (*Grafana) CreateDashboard ¶
CreateDashboard in Grafana using the traditional HTTP API.
func (*Grafana) CreateDashboardWithTags ¶
func (g *Grafana) CreateDashboardWithTags(t *testing.T, apiKey, namespace, name string, tags []string)
CreateDashboardWithTags creates a dashboard in Grafana with the specified tags.
func (*Grafana) CreateOrganisation ¶
CreateOrganisation creates a new organisation in Grafana and returns its ID.
func (*Grafana) ViewDashboardInUI ¶
ViewDashboardInUI simulates viewing a dashboard in the Grafana UI by calling the /dto endpoint. When a user views a dashboard in the Grafana web interface, the frontend JavaScript makes an API call to the /dto endpoint to fetch the dashboard data. This method simulates that API call.