Fix volume secret_test.go on darwin by not checking volume usage metrics

This commit is contained in:
Phillip Wittrock
2016-02-16 17:16:06 -08:00
parent 6c638b5f3f
commit 1e5175594d
5 changed files with 88 additions and 17 deletions

View File

@@ -21,10 +21,10 @@ import (
"io/ioutil"
"os"
"path"
"runtime"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"k8s.io/kubernetes/pkg/api"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/testing/fake"
@@ -33,6 +33,8 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/empty_dir"
"k8s.io/kubernetes/pkg/volume/util"
"github.com/stretchr/testify/assert"
)
func newTestHost(t *testing.T, clientset clientset.Interface) (string, volume.VolumeHost) {
@@ -122,12 +124,16 @@ func TestPlugin(t *testing.T) {
}
}
doTestSecretDataInVolume(volumePath, secret, t)
defer doTestCleanAndTeardown(plugin, testPodUID, testVolumeName, volumePath, t)
// Metrics only supported on linux
metrics, err := builder.GetMetrics()
assert.NotEmpty(t, metrics)
assert.NoError(t, err)
doTestCleanAndTeardown(plugin, testPodUID, testVolumeName, volumePath, t)
if runtime.GOOS == "linux" {
assert.NotEmpty(t, metrics)
assert.NoError(t, err)
} else {
t.Skipf("Volume metrics not supported on %s", runtime.GOOS)
}
}
// Test the case where the 'ready' file has been created and the pod volume dir