Skip to content

Commit

Permalink
Update test for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
e-dard committed Jun 14, 2017
1 parent f20ba10 commit 93e35f1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tsdb/index/tsi1/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"regexp"
"sort"
Expand Down Expand Up @@ -199,14 +198,19 @@ func (i *Index) Open() error {

// ReplaceIndex returns a new index built using the provided file paths.
func (i *Index) ReplaceIndex(newFiles []string) (*Index, error) {
var base string
var (
base string
indexMatch = fmt.Sprintf("%[1]s%s%[1]s", string(os.PathSeparator), "index")
)

for _, pth := range newFiles {
if !strings.Contains(pth, "/index") {
if !strings.Contains(pth, indexMatch) ||
(!strings.Contains(pth, LogFileExt) && !strings.Contains(pth, IndexFileExt)) {
continue // Not a tsi1 file path.
}

if base == "" {
base = path.Dir(pth)
base = filepath.Dir(pth)
}
if err := os.Rename(pth, strings.TrimSuffix(pth, ".tmp")); err != nil {
return nil, err
Expand Down

0 comments on commit 93e35f1

Please sign in to comment.