MCPcopy Index your code
hub / github.com/coder/coder / TestPrometheusBannerEntry

Function TestPrometheusBannerEntry

scripts/develop/main_test.go:810–857  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

808}
809
810func TestPrometheusBannerEntry(t *testing.T) {
811 t.Parallel()
812
813 cases := []struct {
814 name string
815 cfg *devConfig
816 started bool
817 wantLabel string
818 wantPort int64
819 }{
820 {
821 name: "MetricsDisabled",
822 cfg: &devConfig{coderMetricsPort: 0},
823 started: false,
824 wantLabel: "",
825 wantPort: 0,
826 },
827 {
828 name: "MetricsOnlyDefault",
829 cfg: &devConfig{coderMetricsPort: 2114},
830 started: false,
831 wantLabel: "Metrics:",
832 wantPort: 2114,
833 },
834 {
835 name: "PrometheusServerUp",
836 cfg: &devConfig{coderMetricsPort: 2114, prometheusServer: true},
837 started: true,
838 wantLabel: "Prometheus UI:",
839 wantPort: prometheusServerPort,
840 },
841 {
842 name: "ServerRequestedButDown",
843 cfg: &devConfig{coderMetricsPort: 2114, prometheusServer: true},
844 started: false,
845 wantLabel: "Metrics:",
846 wantPort: 2114,
847 },
848 }
849 for _, tc := range cases {
850 t.Run(tc.name, func(t *testing.T) {
851 t.Parallel()
852 label, port := prometheusBannerEntry(tc.cfg, tc.started)
853 assert.Equal(t, tc.wantLabel, label)
854 assert.Equal(t, tc.wantPort, port)
855 })
856 }
857}
858
859//nolint:paralleltest // loadEnvFile mutates process-global environment.
860func TestLoadEnvFile(t *testing.T) {

Callers

nothing calls this directly

Calls 3

prometheusBannerEntryFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected