(t *testing.T)
| 808 | } |
| 809 | |
| 810 | func 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. |
| 860 | func TestLoadEnvFile(t *testing.T) { |
nothing calls this directly
no test coverage detected