Wrote and applied helper function for tests

replaced with new function

removed log/slog

readded log/slog when needed

fixed last testwriter problems
This commit is contained in:
miampf 2024-01-22 14:18:49 +01:00
parent 944bdedc59
commit 76ada50c17
No known key found for this signature in database
GPG key ID: 376EAC0E5307A669
55 changed files with 133 additions and 178 deletions

View file

@ -8,7 +8,6 @@ package cmd
import (
"context"
"log/slog"
"net/http"
"net/url"
"testing"
@ -181,7 +180,7 @@ func TestConfigFetchMeasurements(t *testing.T) {
err := fileHandler.WriteYAML(constants.ConfigFilename, gcpConfig, file.OptMkdirAll)
require.NoError(err)
fetcher := stubVerifyFetcher{err: tc.err}
cfm := &configFetchMeasurementsCmd{canFetchMeasurements: true, log: slog.New(slog.NewTextHandler(logger.TestWriter{T: t}, nil)), verifyFetcher: fetcher}
cfm := &configFetchMeasurementsCmd{canFetchMeasurements: true, log: logger.NewTest(t), verifyFetcher: fetcher}
cfm.flags.insecure = tc.insecureFlag
cfm.flags.force = true