Skip to content

Commit

Permalink
206-doublestar-mount Simplified config_test and fixed duplicate const…
Browse files Browse the repository at this point in the history
…ants
  • Loading branch information
bdebyl committed Jul 19, 2022
1 parent ba52e9b commit f162b55
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions internal/plugin/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,11 @@ import (
"fmt"
"os"
"reflect"
"strings"
"testing"
"time"

"github.com/meltwater/drone-cache/archive"
"github.com/meltwater/drone-cache/test"
)

const (
testRoot = "testdata"
defaultStorageOperationTimeout = 5 * time.Second
)

func TestHandleMount(t *testing.T) {
test.Ok(t, os.Mkdir(testRoot, 0755))
t.Cleanup(func() {
Expand Down Expand Up @@ -62,7 +54,7 @@ func TestHandleMount(t *testing.T) {
}

for _, tc := range cases {
c := defaultConfig()
c := Config{}
c.Mount = tc.mounts

tc.makeFiles()
Expand All @@ -72,23 +64,3 @@ func TestHandleMount(t *testing.T) {
"expected mount differs from handled mount result:\nexpected: %v\ngot:%v", tc.expectedMounts, c.Mount)
}
}

// Config plugin configuration

func defaultConfig() *Config {
return &Config{
CompressionLevel: archive.DefaultCompressionLevel,
StorageOperationTimeout: defaultStorageOperationTimeout,
Override: true,
}
}

func containsGlob(a []string) bool {
for _, v := range a {
if strings.Contains(v, "**") {
return true
}
}

return false
}

0 comments on commit f162b55

Please sign in to comment.