Merged in feature/lint (pull request #87)

Basic Lint Checks

* basic
This commit is contained in:
Michael McGuinness
2025-03-05 12:05:46 +00:00
parent 1232ed528f
commit 0815cb35fb
229 changed files with 487 additions and 193 deletions
@@ -3,9 +3,10 @@ package observability_test
import (
"context"
"fmt"
"queryorchestration/internal/serviceconfig/observability"
"testing"
"queryorchestration/internal/serviceconfig/observability"
"github.com/stretchr/testify/assert"
)
@@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"sync"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
@@ -121,8 +122,9 @@ func New(ctx context.Context, config MetricsConfig) (*Metrics, error) {
mux.Handle("/metrics", promhttp.Handler())
m.server = &http.Server{
Addr: fmt.Sprintf(":%d", config.Port),
Handler: mux,
Addr: fmt.Sprintf(":%d", config.Port),
Handler: mux,
ReadHeaderTimeout: time.Minute,
}
go func() {
@@ -27,7 +27,12 @@ func GetFreePortForTesting() (int, error) {
defer l.Close()
// Get the port that was assigned by the OS
return l.Addr().(*net.TCPAddr).Port, nil
addr, ok := l.Addr().(*net.TCPAddr)
if !ok {
return 0, fmt.Errorf("failed to parse TCP address")
}
return addr.Port, nil
}
func TestMetricsIntegration(t *testing.T) {