From a0b9a6b2259ebea7bacb60ed2623f5aa9bcd242b Mon Sep 17 00:00:00 2001 From: Carson Long Date: Tue, 18 Oct 2022 10:47:24 -0700 Subject: [PATCH 1/3] CI: run Go workflow on windows as well We should test the blackbox code for all the cases where it will be used: * as a linux binary in the syslog-release * as a windows binary in the windows-syslog-release --- .github/workflows/go.yml | 47 +++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 13ee4b86..68482cc5 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -10,28 +10,39 @@ on: jobs: test: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: "go.mod" - - run: go run github.com/onsi/ginkgo/v2/ginkgo -r --procs=3 --compilers=3 --randomize-all --randomize-suites --fail-on-pending --keep-going --race --trace + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: "go.mod" + - run: go run github.com/onsi/ginkgo/v2/ginkgo -r --procs=3 --compilers=3 --randomize-all --randomize-suites --fail-on-pending --keep-going --race --trace vet: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: "go.mod" - - run: go vet ./... + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: "go.mod" + - run: go vet ./... lint: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: "go.mod" - - uses: golangci/golangci-lint-action@v3.2.0 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: "go.mod" + - uses: golangci/golangci-lint-action@v3.2.0 + with: + args: --timeout 5m From de3eaad9a163bded54bcad8d26cb769a11ec8cc3 Mon Sep 17 00:00:00 2001 From: Carson Long Date: Tue, 18 Oct 2022 10:49:05 -0700 Subject: [PATCH 2/3] CI: run go workflow on a weekly schedule --- .github/workflows/go.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 68482cc5..514fa626 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,6 +7,8 @@ on: pull_request: branches: - main + schedule: + - cron: '40 1 * * 2' jobs: test: From d9bc505b3a7d20cc3588d51d2f012eda59fd8e8c Mon Sep 17 00:00:00 2001 From: Carson Long Date: Tue, 18 Oct 2022 13:59:17 -0700 Subject: [PATCH 3/3] Fix integration tests for windows * the subdirectory/filename tag in Windows has a different separator, match on both that and the linux separator. * The trailing space appears to be removed by `os.Mkdir()` on Windows, remove it to make that test pass, as we already test that a space is ignored earlier in that string. --- integration/syslog_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/syslog_test.go b/integration/syslog_test.go index 558b93a6..fbe8e903 100644 --- a/integration/syslog_test.go +++ b/integration/syslog_test.go @@ -215,7 +215,7 @@ var _ = Describe("Blackbox", func() { var message *sl.Message Eventually(inbox.Messages, "5s").Should(Receive(&message)) - Expect(message.Content).To(ContainSubstring(tagName + "/" + logfileName)) + Expect(message.Content).To(MatchRegexp(tagName + `[/\\]` + logfileName)) blackboxRunner.Stop() }) @@ -249,7 +249,7 @@ var _ = Describe("Blackbox", func() { blackboxRunner.Stop() }) It("removes all characters that are not between ASCII 33 - 126 from the tag name", func() { - specialCharsName := "ab c§d " + specialCharsName := "ab c§d" expectedNoSpecialCharsName := "abcd" err := os.Mkdir(filepath.Join(logDir, specialCharsName), os.ModePerm)