mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-29 13:08:18 +00:00
* metrics: Add Metrics tags to multiple Scopes * metrics: Fix base_repo and pr_number * metrics: Refactor SetScope to SetScopeTags * metrics: Add SetGitScopeTags function * metrics: docs reword project_context SetScopeTags description * metrics: test Add TestNewScope_PrometheusTaggingCapabilities
35 lines
699 B
Go
35 lines
699 B
Go
package metrics_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/runatlantis/atlantis/server/core/config/valid"
|
|
"github.com/runatlantis/atlantis/server/metrics"
|
|
)
|
|
|
|
var (
|
|
prometheusConfig = valid.Metrics{
|
|
Prometheus: &valid.Prometheus{
|
|
Endpoint: "/metrics",
|
|
},
|
|
}
|
|
)
|
|
|
|
func TestNewScope_PrometheusTaggingCapabilities(t *testing.T) {
|
|
scope, _, _, err := metrics.NewScope(prometheusConfig, nil, "test")
|
|
if err != nil {
|
|
t.Fatalf("got an error: %s", err.Error())
|
|
}
|
|
|
|
scope.Tagged(map[string]string{
|
|
"base_repo": "runatlantis/atlantis",
|
|
"pr_number": "2687",
|
|
})
|
|
|
|
want := true
|
|
got := scope.Capabilities().Tagging()
|
|
if want != got {
|
|
t.Errorf("Scope does not have Capability to do Tagging")
|
|
}
|
|
}
|