Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added e2e tests for list #2656

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ func (raw rawListCmdArgs) parseProperties() []validProperty {
}

func (raw rawListCmdArgs) cook() (cookedListCmdArgs, error) {
// set up the front end scanning logger
azcopyScanningLogger = common.NewJobLogger(azcopyCurrentJobID, azcopyLogVerbosity, azcopyLogPathFolder, "-scanning")
azcopyScanningLogger.OpenLog()
glcm.RegisterCloseFunc(func() {
azcopyScanningLogger.CloseLog()
})
cooked = cookedListCmdArgs{}
// the expected argument in input is the container sas / or path of virtual directory in the container.
// verifying the location type
Expand Down
1 change: 0 additions & 1 deletion common/fe-ste-models.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,6 @@ func (Location) AzureAccount() Location { return Location(100) } // AzureAccount
func (l Location) String() string {
return enum.StringInt(l, reflect.TypeOf(l))
}

func (l *Location) Parse(s string) error {
val, err := enum.ParseInt(reflect.TypeOf(l), s, true, true)
if err == nil {
Expand Down
3 changes: 3 additions & 0 deletions e2etest/newe2e_resource_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ type ResourceDefinitionObject struct {
Body ObjectContentContainer
// ObjectShouldExist is true unless set to false. Useful in negative validation (e.g. remove)
ObjectShouldExist *bool

// This is used only to pass the size of the object when making a list of expected objects
Size string
}

func (r ResourceDefinitionObject) GenerateAdoptiveParent(a Asserter) ResourceDefinition {
Expand Down
3 changes: 2 additions & 1 deletion e2etest/newe2e_resource_manager_azstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package e2etest

import (
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
blobsas "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas"
blobservice "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"
blobfscommon "github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake"
Expand Down Expand Up @@ -140,7 +141,7 @@ func (acct *AzureAccountResourceManager) GetService(a Asserter, location common.
case common.ELocation.File():
sharedKey, err := fileservice.NewSharedKeyCredential(acct.accountName, acct.accountKey)
a.NoError("Create shared key", err)
client, err := fileservice.NewClientWithSharedKeyCredential(uri, sharedKey, nil)
client, err := fileservice.NewClientWithSharedKeyCredential(uri, sharedKey, &fileservice.ClientOptions{AllowTrailingDot: to.Ptr(true)})
a.NoError("Create File client", err)

return &FileServiceResourceManager{
Expand Down
6 changes: 6 additions & 0 deletions e2etest/newe2e_resource_manager_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package e2etest
import (
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/lease"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/pageblob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azfile/share"
"github.com/Azure/azure-storage-azcopy/v10/cmd"
Expand Down Expand Up @@ -278,6 +279,11 @@ type BlobProperties struct {
BlockBlobAccessTier *blob.AccessTier
PageBlobAccessTier *pageblob.PremiumPageBlobAccessTier
VersionId *string
LastModifiedTime *time.Time
LeaseState *lease.StateType
LeaseDuration *lease.DurationType
LeaseStatus *lease.StatusType
ArchiveStatus *blob.ArchiveStatus
}

type BlobFSProperties struct {
Expand Down
31 changes: 29 additions & 2 deletions e2etest/newe2e_resource_managers_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package e2etest

import (
"bytes"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/appendblob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror"
Expand All @@ -16,6 +17,7 @@ import (
"regexp"
"runtime"
"strings"
"time"
)

/*
Expand Down Expand Up @@ -627,6 +629,12 @@ func (b *BlobObjectResourceManager) GetPropertiesWithOptions(a Asserter, options
},
Metadata: resp.Metadata,
BlobProperties: BlobProperties{
LastModifiedTime: func() *time.Time {
if resp.LastModified == nil {
return nil
}
return to.Ptr(resp.LastModified.UTC())
}(),
VersionId: resp.VersionID,
Type: resp.BlobType,
Tags: func() map[string]string {
Expand All @@ -643,8 +651,27 @@ func (b *BlobObjectResourceManager) GetPropertiesWithOptions(a Asserter, options

return out
}(),
BlockBlobAccessTier: nil,
PageBlobAccessTier: nil,
BlockBlobAccessTier: func() *blob.AccessTier {
if resp.AccessTier == nil {
return nil
}
return to.Ptr(blob.AccessTier(*resp.AccessTier))
}(),
PageBlobAccessTier: func() *pageblob.PremiumPageBlobAccessTier {
if resp.AccessTier == nil {
return nil
}
return to.Ptr(pageblob.PremiumPageBlobAccessTier(*resp.AccessTier))
}(),
LeaseState: resp.LeaseState,
LeaseDuration: resp.LeaseDuration,
LeaseStatus: resp.LeaseStatus,
ArchiveStatus: func() *blob.ArchiveStatus {
if resp.ArchiveStatus == nil {
return nil
}
return to.Ptr(blob.ArchiveStatus(*resp.ArchiveStatus))
}(),
},
}
}
Expand Down