Skip to content

Commit

Permalink
Fix windows tests that are failing CI on main (#5916)
Browse files Browse the repository at this point in the history
* update loki client test for windows differences

* disable integration-tests that don't work in windows when running in windows
  • Loading branch information
erikbaranowski authored Dec 6, 2023
1 parent 300ad36 commit 400c2be
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
6 changes: 4 additions & 2 deletions component/common/loki/client/internal/marker_file_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ const (
MarkerFolderName = "remote"
MarkerFileName = "segment_marker"

MarkerFolderMode os.FileMode = 0o700
MarkerFileMode os.FileMode = 0o600
MarkerFolderMode os.FileMode = 0o700
MarkerWindowsFolderMode os.FileMode = 0o777
MarkerFileMode os.FileMode = 0o600
MarkerWindowsFileMode os.FileMode = 0o666
)

// MarkerFileHandler is a file-backed wal.Marker, that also allows one to write to the backing store as particular
Expand Down
13 changes: 11 additions & 2 deletions component/common/loki/client/internal/marker_file_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package internal
import (
"os"
"path/filepath"
"runtime"
"testing"

"github.com/go-kit/log"
Expand Down Expand Up @@ -57,10 +58,18 @@ func TestMarkerFileHandler(t *testing.T) {
// check folder first
stats, err := os.Stat(filepath.Join(dir, MarkerFolderName))
require.NoError(t, err)
require.Equal(t, MarkerFolderMode, stats.Mode().Perm())
if runtime.GOOS == "windows" {
require.Equal(t, MarkerWindowsFolderMode, stats.Mode().Perm())
} else {
require.Equal(t, MarkerFolderMode, stats.Mode().Perm())
}
// then file
stats, err = os.Stat(filepath.Join(dir, MarkerFolderName, MarkerFileName))
require.NoError(t, err)
require.Equal(t, MarkerFileMode, stats.Mode().Perm())
if runtime.GOOS == "windows" {
require.Equal(t, MarkerWindowsFileMode, stats.Mode().Perm())
} else {
require.Equal(t, MarkerFileMode, stats.Mode().Perm())
}
})
}
2 changes: 2 additions & 0 deletions integration-tests/tests/otlp-metrics/otlp_metrics_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !windows

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/tests/read-log-file/read_log_file_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !windows

package main

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !windows

package main

import (
Expand Down

0 comments on commit 400c2be

Please sign in to comment.