mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-29 21:29:24 +00:00
Fix volume secret_test.go on darwin by not checking volume usage metrics
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user