From 090631475172613a59d393f79a17a267f9ac68cf Mon Sep 17 00:00:00 2001 From: ntap-nmarco <104501609+ntap-nmarco@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:21:54 +0100 Subject: [PATCH] update golang to version 1.21.5 --- .github/workflows/release.yml | 2 +- .github/workflows/unit-test.yml | 4 +- CHANGELOG.md | 7 ++- cmd/fluent-bit/Dockerfile | 2 +- cmd/logcli/Dockerfile | 2 +- cmd/migrate/Dockerfile | 2 +- cmd/querytee/Dockerfile | 2 +- cmd/querytee/Dockerfile.cross | 2 +- cmd/vali-canary/Dockerfile | 2 +- cmd/vali-canary/Dockerfile.cross | 2 +- cmd/vali/Dockerfile | 2 +- cmd/vali/Dockerfile.cross | 2 +- cmd/valitail/Dockerfile | 2 +- cmd/valitail/Dockerfile.cross | 2 +- pkg/logentry/stages/metrics.go | 9 ++-- pkg/logentry/stages/metrics_test.go | 2 +- pkg/logentry/stages/pack_test.go | 33 +++++++------ pkg/logproto/timestamp.go | 7 +-- pkg/valitail/targets/file/filetarget_test.go | 49 +++++++++++-------- .../targets/journal/journaltarget_test.go | 25 ++++++---- vali-build-image/Dockerfile | 4 +- 21 files changed, 94 insertions(+), 70 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 24c9df5c..74bd10f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.21.3 + go-version: 1.21.5 - name: Install package dependencies run: | diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index bc72256b..0bd72c49 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.21.3 + go-version: 1.21.5 - name: Install package dependencies run: | @@ -40,7 +40,7 @@ jobs: run: | cd / curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ - | sudo sh -s v1.52.0 + | sudo sh -s v1.55.2 - name: Run Linter run: make lint diff --git a/CHANGELOG.md b/CHANGELOG.md index 86a51cb0..f033ae6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ -## 2.2.10 (2023-11-07) +## 2.2.12 (2023-12-07) + +* Upgrade Go to 1.21.5 +* Include LogCLI binary + +## 2.2.11 (2023-11-07) * Upgrade Go to 1.21.3 diff --git a/cmd/fluent-bit/Dockerfile b/cmd/fluent-bit/Dockerfile index 22e0b3e3..cc960a57 100644 --- a/cmd/fluent-bit/Dockerfile +++ b/cmd/fluent-bit/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.5 as build COPY . /src/vali WORKDIR /src/vali RUN make clean && make BUILD_IN_CONTAINER=false fluent-bit-plugin diff --git a/cmd/logcli/Dockerfile b/cmd/logcli/Dockerfile index 924f5a4d..7513216e 100644 --- a/cmd/logcli/Dockerfile +++ b/cmd/logcli/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.5 as build ARG TOUCH_PROTOS COPY . /src/vali diff --git a/cmd/migrate/Dockerfile b/cmd/migrate/Dockerfile index 8eb636af..90ededd3 100644 --- a/cmd/migrate/Dockerfile +++ b/cmd/migrate/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.5 as build COPY . /src/vali WORKDIR /src/vali RUN make clean && make BUILD_IN_CONTAINER=false migrate diff --git a/cmd/querytee/Dockerfile b/cmd/querytee/Dockerfile index 71301814..a4c94be4 100644 --- a/cmd/querytee/Dockerfile +++ b/cmd/querytee/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.5 as build ARG TOUCH_PROTOS COPY . /src/vali diff --git a/cmd/querytee/Dockerfile.cross b/cmd/querytee/Dockerfile.cross index 3367a19a..81be00ea 100644 --- a/cmd/querytee/Dockerfile.cross +++ b/cmd/querytee/Dockerfile.cross @@ -2,7 +2,7 @@ ARG BUILD_IMAGE=ghcr.io/credativ/vali-build-image:0.9.1 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t ghcr.io/credativ/valitail -f cmd/valitail/Dockerfile . -FROM golang:1.21.3-alpine as goenv +FROM golang:1.21.5-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/cmd/vali-canary/Dockerfile b/cmd/vali-canary/Dockerfile index 1b3eb532..cdc4e324 100644 --- a/cmd/vali-canary/Dockerfile +++ b/cmd/vali-canary/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.5 as build # TOUCH_PROTOS signifies if we should touch the compiled proto files and thus not regenerate them. # This is helpful when file system timestamps can't be trusted with make ARG TOUCH_PROTOS diff --git a/cmd/vali-canary/Dockerfile.cross b/cmd/vali-canary/Dockerfile.cross index 845f3fd4..7c242d3b 100644 --- a/cmd/vali-canary/Dockerfile.cross +++ b/cmd/vali-canary/Dockerfile.cross @@ -2,7 +2,7 @@ ARG BUILD_IMAGE=ghcr.io/credativ/vali-build-image:0.12.0 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t ghcr.io/credativ/valitail -f cmd/valitail/Dockerfile . -FROM golang:1.21.3-alpine as goenv +FROM golang:1.21.5-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/cmd/vali/Dockerfile b/cmd/vali/Dockerfile index 1800c95e..ea9fb57e 100644 --- a/cmd/vali/Dockerfile +++ b/cmd/vali/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.5 as build # TOUCH_PROTOS signifies if we should touch the compiled proto files and thus not regenerate them. # This is helpful when file system timestamps can't be trusted with make ARG TOUCH_PROTOS diff --git a/cmd/vali/Dockerfile.cross b/cmd/vali/Dockerfile.cross index 5eb0aa56..5f4efaad 100644 --- a/cmd/vali/Dockerfile.cross +++ b/cmd/vali/Dockerfile.cross @@ -2,7 +2,7 @@ ARG BUILD_IMAGE=ghcr.io/credativ/vali-build-image:0.12.0 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t ghcr.io/credativ/vali -f cmd/vali/Dockerfile . -FROM golang:1.21.3-alpine as goenv +FROM golang:1.21.5-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/cmd/valitail/Dockerfile b/cmd/valitail/Dockerfile index 9d7bb352..68d29cb8 100644 --- a/cmd/valitail/Dockerfile +++ b/cmd/valitail/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3-bullseye as build +FROM golang:1.21.5-bullseye as build # TOUCH_PROTOS signifies if we should touch the compiled proto files and thus not regenerate them. # This is helpful when file system timestamps can't be trusted with make ARG TOUCH_PROTOS diff --git a/cmd/valitail/Dockerfile.cross b/cmd/valitail/Dockerfile.cross index 175ca53e..74175ad4 100644 --- a/cmd/valitail/Dockerfile.cross +++ b/cmd/valitail/Dockerfile.cross @@ -2,7 +2,7 @@ ARG BUILD_IMAGE=ghcr.io/credativ/vali-build-image:0.12.0 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t ghcr.io/credativ/valitail -f cmd/valitail/Dockerfile . -FROM golang:1.21.3-alpine as goenv +FROM golang:1.21.5-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/pkg/logentry/stages/metrics.go b/pkg/logentry/stages/metrics.go index 0db6e534..0e09f431 100644 --- a/pkg/logentry/stages/metrics.go +++ b/pkg/logentry/stages/metrics.go @@ -27,6 +27,7 @@ const ( ErrMetricsStageInvalidType = "invalid metric type '%s', metric type must be one of 'counter', 'gauge', or 'histogram'" ErrInvalidIdleDur = "max_idle_duration could not be parsed as a time.Duration: '%s'" ErrSubSecIdleDur = "max_idle_duration less than 1s not allowed" + ErrValueToStringConversion = "failed to convert extracted value to string" ) // MetricConfig is a single metrics configuration. @@ -185,8 +186,8 @@ func (m *metricStage) recordCounter(name string, counter *metric.Counters, label stringVal, err := getString(v) if err != nil { if Debug { - level.Debug(m.logger).Log("msg", "failed to convert extracted value to string, "+ - "can't perform value comparison", "metric", name, "err", + level.Debug(m.logger).Log("msg", ErrValueToStringConversion+ + ", can't perform value comparison", "metric", name, "err", fmt.Sprintf("can't convert %v to string", reflect.TypeOf(v))) } return @@ -218,7 +219,7 @@ func (m *metricStage) recordGauge(name string, gauge *metric.Gauges, labels mode stringVal, err := getString(v) if err != nil { if Debug { - level.Debug(m.logger).Log("msg", "failed to convert extracted value to string, "+ + level.Debug(m.logger).Log("msg", ErrValueToStringConversion+ "can't perform value comparison", "metric", name, "err", fmt.Sprintf("can't convert %v to string", reflect.TypeOf(v))) } @@ -271,7 +272,7 @@ func (m *metricStage) recordHistogram(name string, histogram *metric.Histograms, stringVal, err := getString(v) if err != nil { if Debug { - level.Debug(m.logger).Log("msg", "failed to convert extracted value to string, "+ + level.Debug(m.logger).Log("msg", ErrValueToStringConversion+ "can't perform value comparison", "metric", name, "err", fmt.Sprintf("can't convert %v to string", reflect.TypeOf(v))) } diff --git a/pkg/logentry/stages/metrics_test.go b/pkg/logentry/stages/metrics_test.go index 41895e1b..d2bf8f7f 100644 --- a/pkg/logentry/stages/metrics_test.go +++ b/pkg/logentry/stages/metrics_test.go @@ -135,7 +135,7 @@ func TestPipelineWithMissingKey_Metrics(t *testing.T) { } Debug = true processEntries(pl, newEntry(nil, nil, testMetricLogLineWithMissingKey, time.Now())) - expectedLog := "level=debug msg=\"failed to convert extracted value to string, can't perform value comparison\" metric=bvali_count err=\"can't convert to string\"" + expectedLog := "level=debug msg=\"failed to convert extracted value to string, can't perform value comparison\" metric=vali_count err=\"can't convert to string\"" if !(strings.Contains(buf.String(), expectedLog)) { t.Errorf("\nexpected: %s\n+actual: %s", expectedLog, buf.String()) } diff --git a/pkg/logentry/stages/pack_test.go b/pkg/logentry/stages/pack_test.go index 512f3581..bb87eff4 100644 --- a/pkg/logentry/stages/pack_test.go +++ b/pkg/logentry/stages/pack_test.go @@ -17,6 +17,11 @@ import ( "github.com/credativ/vali/pkg/valitail/api" ) +const ( + TestLine1 = "test line 1" + TestLine1ColonQuoted = ":\"test line 1\"" +) + // Not all these are tested but are here to make sure the different types marshal without error var testPackYaml = ` pipeline_stages: @@ -128,7 +133,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "test line 1", + Line: TestLine1, }, }, }, @@ -140,7 +145,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "{\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}", + Line: "{\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}", }, }, }, @@ -160,7 +165,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "test line 1", + Line: TestLine1, }, }, }, @@ -171,7 +176,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "{\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}", + Line: "{\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}", }, }, }, @@ -191,7 +196,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "test line 1", + Line: TestLine1, }, }, }, @@ -200,7 +205,7 @@ func Test_packStage_Run(t *testing.T) { Labels: model.LabelSet{}, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "{\"bar\":\"baz\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}", + Line: "{\"bar\":\"baz\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}", }, }, }, @@ -223,7 +228,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "test line 1", + Line: TestLine1, }, }, }, @@ -234,7 +239,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "{\"extr1\":\"etr1val\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}", + Line: "{\"extr1\":\"etr1val\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}", }, }, }, @@ -257,7 +262,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "test line 1", + Line: TestLine1, }, }, }, @@ -268,7 +273,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "{\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}", + Line: "{\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}", }, }, }, @@ -291,7 +296,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "test line 1", + Line: TestLine1, }, }, }, @@ -302,7 +307,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "{\"ex\\\"tr2\":\"\\\"fd\\\"\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}", + Line: "{\"ex\\\"tr2\":\"\\\"fd\\\"\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}", }, }, }, @@ -322,7 +327,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), - Line: "test line 1", + Line: TestLine1, }, }, }, @@ -334,7 +339,7 @@ func Test_packStage_Run(t *testing.T) { }, Entry: logproto.Entry{ Timestamp: time.Unix(1, 0), // Ignored in test execution below - Line: "{\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}", + Line: "{\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}", }, }, }, diff --git a/pkg/logproto/timestamp.go b/pkg/logproto/timestamp.go index f2fb323f..30a69cf3 100644 --- a/pkg/logproto/timestamp.go +++ b/pkg/logproto/timestamp.go @@ -15,6 +15,7 @@ const ( // Seconds field just after the latest valid Timestamp. // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). maxValidSeconds = 253402300800 + TimestampLabel = "timestamp: " ) // validateTimestamp determines whether a Timestamp is valid. @@ -32,13 +33,13 @@ func validateTimestamp(ts *types.Timestamp) error { return errors.New("timestamp: nil Timestamp") } if ts.Seconds < minValidSeconds { - return errors.New("timestamp: " + formatTimestamp(ts) + " before 0001-01-01") + return errors.New(TimestampLabel + formatTimestamp(ts) + " before 0001-01-01") } if ts.Seconds >= maxValidSeconds { - return errors.New("timestamp: " + formatTimestamp(ts) + " after 10000-01-01") + return errors.New(TimestampLabel + formatTimestamp(ts) + " after 10000-01-01") } if ts.Nanos < 0 || ts.Nanos >= 1e9 { - return errors.New("timestamp: " + formatTimestamp(ts) + ": nanos not in range [0, 1e9)") + return errors.New(TimestampLabel + formatTimestamp(ts) + ": nanos not in range [0, 1e9)") } return nil } diff --git a/pkg/valitail/targets/file/filetarget_test.go b/pkg/valitail/targets/file/filetarget_test.go index f3032610..5cf904cc 100644 --- a/pkg/valitail/targets/file/filetarget_test.go +++ b/pkg/valitail/targets/file/filetarget_test.go @@ -17,14 +17,21 @@ import ( "github.com/credativ/vali/pkg/valitail/targets/testutils" ) +const ( + TmpDirPath = "/tmp/" + PositionsFileNameRoot = "/positions.yml" + LogFileNameRoot = "/test.log" + LogFileWildcard = "/*.log" +) + func TestLongPositionsSyncDelayStillSavesCorrectPosition(t *testing.T) { w := log.NewSyncWriter(os.Stderr) logger := log.NewLogfmtLogger(w) testutils.InitRandom() - dirName := "/tmp/" + testutils.RandName() - positionsFileName := dirName + "/positions.yml" - logFile := dirName + "/test.log" + dirName := TmpDirPath + testutils.RandName() + positionsFileName := dirName + PositionsFileNameRoot + logFile := dirName + LogFileNameRoot err := os.MkdirAll(dirName, 0750) if err != nil { @@ -110,8 +117,8 @@ func TestWatchEntireDirectory(t *testing.T) { logger := log.NewLogfmtLogger(w) testutils.InitRandom() - dirName := "/tmp/" + testutils.RandName() - positionsFileName := dirName + "/positions.yml" + dirName := TmpDirPath + testutils.RandName() + positionsFileName := dirName + PositionsFileNameRoot logFileDir := dirName + "/logdir/" err := os.MkdirAll(dirName, 0750) @@ -202,9 +209,9 @@ func TestFileRolls(t *testing.T) { logger := log.NewLogfmtLogger(w) testutils.InitRandom() - dirName := "/tmp/" + testutils.RandName() - positionsFile := dirName + "/positions.yml" - logFile := dirName + "/test.log" + dirName := TmpDirPath + testutils.RandName() + positionsFile := dirName + PositionsFileNameRoot + logFile := dirName + LogFileNameRoot err := os.MkdirAll(dirName, 0750) if err != nil { @@ -231,7 +238,7 @@ func TestFileRolls(t *testing.T) { } metrics := NewMetrics(nil) - target, err := NewFileTarget(metrics, logger, client, positions, dirName+"/*.log", nil, nil, &Config{ + target, err := NewFileTarget(metrics, logger, client, positions, dirName+LogFileWildcard, nil, nil, &Config{ SyncPeriod: 10 * time.Second, }) if err != nil { @@ -299,9 +306,9 @@ func TestResumesWhereLeftOff(t *testing.T) { logger := log.NewLogfmtLogger(w) testutils.InitRandom() - dirName := "/tmp/" + testutils.RandName() - positionsFileName := dirName + "/positions.yml" - logFile := dirName + "/test.log" + dirName := TmpDirPath + testutils.RandName() + positionsFileName := dirName + PositionsFileNameRoot + logFile := dirName + LogFileNameRoot err := os.MkdirAll(dirName, 0750) if err != nil { @@ -328,7 +335,7 @@ func TestResumesWhereLeftOff(t *testing.T) { } metrics := NewMetrics(nil) - target, err := NewFileTarget(metrics, logger, client, ps, dirName+"/*.log", nil, nil, &Config{ + target, err := NewFileTarget(metrics, logger, client, ps, dirName+LogFileWildcard, nil, nil, &Config{ SyncPeriod: 10 * time.Second, }) if err != nil { @@ -362,7 +369,7 @@ func TestResumesWhereLeftOff(t *testing.T) { } // Create a new target, keep the same client so we can track what was sent through the handler. - target2, err := NewFileTarget(metrics, logger, client, ps2, dirName+"/*.log", nil, nil, &Config{ + target2, err := NewFileTarget(metrics, logger, client, ps2, dirName+LogFileWildcard, nil, nil, &Config{ SyncPeriod: 10 * time.Second, }) if err != nil { @@ -406,9 +413,9 @@ func TestGlobWithMultipleFiles(t *testing.T) { logger := log.NewLogfmtLogger(w) testutils.InitRandom() - dirName := "/tmp/" + testutils.RandName() - positionsFileName := dirName + "/positions.yml" - logFile1 := dirName + "/test.log" + dirName := TmpDirPath + testutils.RandName() + positionsFileName := dirName + PositionsFileNameRoot + logFile1 := dirName + LogFileNameRoot logFile2 := dirName + "/dirt.log" err := os.MkdirAll(dirName, 0750) @@ -436,7 +443,7 @@ func TestGlobWithMultipleFiles(t *testing.T) { } metrics := NewMetrics(nil) - target, err := NewFileTarget(metrics, logger, client, ps, dirName+"/*.log", nil, nil, &Config{ + target, err := NewFileTarget(metrics, logger, client, ps, dirName+LogFileWildcard, nil, nil, &Config{ SyncPeriod: 10 * time.Second, }) if err != nil { @@ -507,8 +514,8 @@ func TestFileTargetSync(t *testing.T) { logger := log.NewLogfmtLogger(w) testutils.InitRandom() - dirName := "/tmp/" + testutils.RandName() - positionsFileName := dirName + "/positions.yml" + dirName := TmpDirPath + testutils.RandName() + positionsFileName := dirName + PositionsFileNameRoot logDir1 := dirName + "/log1" logDir1File1 := logDir1 + "/test1.log" logDir1File2 := logDir1 + "/test2.log" @@ -533,7 +540,7 @@ func TestFileTargetSync(t *testing.T) { defer client.Stop() metrics := NewMetrics(nil) - target, err := NewFileTarget(metrics, logger, client, ps, logDir1+"/*.log", nil, nil, &Config{ + target, err := NewFileTarget(metrics, logger, client, ps, logDir1+LogFileWildcard, nil, nil, &Config{ SyncPeriod: 10 * time.Second, }) if err != nil { diff --git a/pkg/valitail/targets/journal/journaltarget_test.go b/pkg/valitail/targets/journal/journaltarget_test.go index d91adfcf..eabb8d60 100644 --- a/pkg/valitail/targets/journal/journaltarget_test.go +++ b/pkg/valitail/targets/journal/journaltarget_test.go @@ -22,6 +22,11 @@ import ( "github.com/credativ/vali/pkg/valitail/targets/testutils" ) +const ( + TmpDirPath = "/tmp/" + PositionsFileNameRoot = "/positions.yml" +) + type mockJournalReader struct { config sdjournal.JournalReaderConfig t *testing.T @@ -68,8 +73,8 @@ func TestJournalTarget(t *testing.T) { logger := log.NewLogfmtLogger(w) testutils.InitRandom() - dirName := "/tmp/" + testutils.RandName() - positionsFileName := dirName + "/positions.yml" + dirName := TmpDirPath + testutils.RandName() + positionsFileName := dirName + PositionsFileNameRoot // Set the sync period to a really long value, to guarantee the sync timer // never runs, this way we know everything saved was done through channel @@ -118,8 +123,8 @@ func TestJournalTarget_JSON(t *testing.T) { logger := log.NewLogfmtLogger(w) testutils.InitRandom() - dirName := "/tmp/" + testutils.RandName() - positionsFileName := dirName + "/positions.yml" + dirName := TmpDirPath + testutils.RandName() + positionsFileName := dirName + PositionsFileNameRoot // Set the sync period to a really long value, to guarantee the sync timer // never runs, this way we know everything saved was done through channel @@ -178,8 +183,8 @@ func TestJournalTarget_Since(t *testing.T) { logger := log.NewLogfmtLogger(w) testutils.InitRandom() - dirName := "/tmp/" + testutils.RandName() - positionsFileName := dirName + "/positions.yml" + dirName := TmpDirPath + testutils.RandName() + positionsFileName := dirName + PositionsFileNameRoot // Set the sync period to a really long value, to guarantee the sync timer // never runs, this way we know everything saved was done through channel @@ -212,8 +217,8 @@ func TestJournalTarget_Cursor_TooOld(t *testing.T) { logger := log.NewLogfmtLogger(w) testutils.InitRandom() - dirName := "/tmp/" + testutils.RandName() - positionsFileName := dirName + "/positions.yml" + dirName := TmpDirPath + testutils.RandName() + positionsFileName := dirName + PositionsFileNameRoot // Set the sync period to a really long value, to guarantee the sync timer // never runs, this way we know everything saved was done through channel @@ -252,8 +257,8 @@ func TestJournalTarget_Cursor_NotTooOld(t *testing.T) { logger := log.NewLogfmtLogger(w) testutils.InitRandom() - dirName := "/tmp/" + testutils.RandName() - positionsFileName := dirName + "/positions.yml" + dirName := TmpDirPath + testutils.RandName() + positionsFileName := dirName + PositionsFileNameRoot // Set the sync period to a really long value, to guarantee the sync timer // never runs, this way we know everything saved was done through channel diff --git a/vali-build-image/Dockerfile b/vali-build-image/Dockerfile index 6bb754ca..a9519663 100644 --- a/vali-build-image/Dockerfile +++ b/vali-build-image/Dockerfile @@ -20,10 +20,10 @@ RUN apk add --no-cache docker-cli # Error: # github.com/fatih/faillint@v1.5.0 requires golang.org/x/tools@v0.0.0-20200207224406-61798d64f025 # (not golang.org/x/tools@v0.0.0-20190918214920-58d531046acd from golang.org/x/tools/cmd/goyacc@58d531046acdc757f177387bc1725bfa79895d69) -FROM docker.io/library/golang:1.21.3 as faillint +FROM docker.io/library/golang:1.21.5 as faillint RUN go install github.com/fatih/faillint@v1.11.0 -FROM docker.io/library/golang:1.21.3-bullseye +FROM docker.io/library/golang:1.21.5-bullseye RUN apt-get update && \ apt-get install -qy \ musl gnupg \