Unverified Commit 8042411f authored by k8s-ci-robot's avatar k8s-ci-robot Committed by GitHub

Merge pull request #65296 from lichuqiang/povision_inter_test

Add volume topology-aware dynamic provisioning related integration case
parents 77742ea9 db775814
...@@ -46,6 +46,10 @@ import ( ...@@ -46,6 +46,10 @@ import (
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler" "k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
) )
// A hook specified in storage class to indicate it's provisioning
// is expected to fail.
const ExpectProvisionFailureKey = "expect-provision-failure"
// fakeVolumeHost is useful for testing volume plugins. // fakeVolumeHost is useful for testing volume plugins.
type fakeVolumeHost struct { type fakeVolumeHost struct {
rootDir string rootDir string
...@@ -787,6 +791,12 @@ type FakeProvisioner struct { ...@@ -787,6 +791,12 @@ type FakeProvisioner struct {
} }
func (fc *FakeProvisioner) Provision(selectedNode *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (*v1.PersistentVolume, error) { func (fc *FakeProvisioner) Provision(selectedNode *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (*v1.PersistentVolume, error) {
// Add provision failure hook
if fc.Options.Parameters != nil {
if _, ok := fc.Options.Parameters[ExpectProvisionFailureKey]; ok {
return nil, fmt.Errorf("expected error")
}
}
fullpath := fmt.Sprintf("/tmp/hostpath_pv/%s", uuid.NewUUID()) fullpath := fmt.Sprintf("/tmp/hostpath_pv/%s", uuid.NewUUID())
pv := &v1.PersistentVolume{ pv := &v1.PersistentVolume{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment