Fix volume creation and deletion of Azure File tests

This commit is contained in:
Fabio Bertinatto
2022-03-23 09:34:06 -03:00
parent b5cff9219d
commit dafa0e178d
6 changed files with 42 additions and 20 deletions

View File

@@ -97,7 +97,7 @@ type ProviderInterface interface {
CreatePD(zone string) (string, error)
DeletePD(pdName string) error
CreateShare() (string, string, error)
CreateShare() (string, string, string, error)
DeleteShare(accountName, shareName string) error
CreatePVSource(zone, diskName string) (*v1.PersistentVolumeSource, error)
@@ -140,8 +140,8 @@ func (n NullProvider) DeleteNode(node *v1.Node) error {
return fmt.Errorf("provider does not support DeleteNode")
}
func (n NullProvider) CreateShare() (string, string, error) {
return "", "", fmt.Errorf("provider does not support volume creation")
func (n NullProvider) CreateShare() (string, string, string, error) {
return "", "", "", fmt.Errorf("provider does not support volume creation")
}
func (n NullProvider) DeleteShare(accountName, shareName string) error {

View File

@@ -93,8 +93,8 @@ func (p *Provider) DeleteNode(node *v1.Node) error {
return err
}
func (p *Provider) CreateShare() (string, string, error) {
return "", "", nil
func (p *Provider) CreateShare() (string, string, string, error) {
return "", "", "", nil
}
func (p *Provider) DeleteShare(accountName, shareName string) error {

View File

@@ -86,7 +86,7 @@ func (p *Provider) CreatePD(zone string) (string, error) {
}
// CreateShare creates a share and return its account name and key.
func (p *Provider) CreateShare() (string, string, error) {
func (p *Provider) CreateShare() (string, string, string, error) {
accountOptions := &azure.AccountOptions{
Name: "",
Type: string(compute.StandardLRS),
@@ -102,13 +102,16 @@ func (p *Provider) CreateShare() (string, string, error) {
RequestGiB: 1,
}
a, b, c := p.azureCloud.CreateFileShare(accountOptions, shareOptions)
accountName, accountKey, err := p.azureCloud.CreateFileShare(accountOptions, shareOptions)
if err != nil {
return "", "", "", err
}
return a, b, c
return accountName, accountKey, shareOptions.Name, nil
}
func (p *Provider) DeleteShare(accountName, shareName string) error {
err := p.azureCloud.DeleteFileShare("", accountName, shareName)
err := p.azureCloud.DeleteFileShare(p.azureCloud.ResourceGroup, accountName, shareName)
if err != nil {
framework.Logf("failed to delete Azure File share %q: %v", shareName, err)
}

View File

@@ -225,8 +225,8 @@ func (p *Provider) DeleteNode(node *v1.Node) error {
return p.gceCloud.DeleteInstance(project, zone, node.Name)
}
func (p *Provider) CreateShare() (string, string, error) {
return "", "", nil
func (p *Provider) CreateShare() (string, string, string, error) {
return "", "", "", nil
}
func (p *Provider) DeleteShare(accountName, shareName string) error {

View File

@@ -673,7 +673,7 @@ func createPDWithRetry(zone string) (string, error) {
return "", err
}
func CreateShare() (string, string, error) {
func CreateShare() (string, string, string, error) {
return framework.TestContext.CloudConfig.Provider.CreateShare()
}